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
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
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
Hi Henrik!
Thank you very much for your help. This is exactly what I want..
Marcel Pelletier
Hi again Henrik!
I try but the command Encrypt are not available on my copy of Mathematica 10.0.2.0
May be the command have been removed?
Marcel.
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
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.
Hi Bianca,
Thank you very much for your help and your idea.
Marcel.