Message Boards Message Boards

7 Replies
3 Total Likes
View groups...
Share this post:

Protect or encrypt a Mathematica File?

Posted 8 years ago

I would like to encrypte a Mathematica document with a secret password.

I don't know if Mathematica can do a thing like that...

Marcel Pelletier

POSTED BY: Marcel Pelletier
7 Replies

Hi Bianca,

Thank you very much for your help and your idea.


POSTED BY: Marcel Pelletier

Hi Marcel,

writing your own function should indeed be a lot of fun. However, setting up your own encryption scheme is a great recipe for ending up with very weak encryption. It's so easy to make mistakes that are not obvious at all. Try this Google search. Anyway, if you just want to deter casual nosiness and you won't have a real problem if that file is hacked, then go ahead and have fun.

Alternatively to a native Mathematica solution, you can of course use any encryption tool that can encrypt an arbitrary file. If the notebook is large, you may get a double benefit out of something like a password protected zip archive.

POSTED BY: Bianca Eifert

Hi Bill,

Thank you.

Now I have to decide to upgrade or program myself a new function for crypting my data...

In fact, programming a new function is more cool!

Marcel Pelletier

POSTED BY: Marcel Pelletier
Posted 8 years ago

At the bottom of this it says it was newly introduced in version 10.1

There is also the much older Encode here

Use at least as much care with those as your information is worth.

POSTED BY: Bill Simpson

Hi again Henrik!

I try but the command Encrypt are not available on my copy of Mathematica

May be the command have been removed?


POSTED BY: Marcel Pelletier

Hi Henrik! Thank you very much for your help. This is exactly what I want.. Marcel Pelletier

POSTED BY: Marcel Pelletier

Hi Marcel,

you could use the commands Encrypt and Decrypt and apply these on an expression containing a whole notebook. The encryption would look like:

notebook = << "SecretNotebook.nb";
encrNotebook = Encrypt["sectretPW", notebook];
encrNotebook >> "Protected_SecretNotebook.nb";
(*  then one might consider to execute:
DeleteFile["SecretNotebook.nb"];  *)

and the decryption:

encrNotebook = << "Protected_SecretNotebook.nb";
notebook = Decrypt["sectretPW", encrNotebook];
notebook >> "RestoredSecretNotebook.nb";

This might be a good protection in case of curious neighbors, but on a more general level I do not believe in the usefulness of an encryption algorithm which is not open source!

Regards -- Henrik

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract