Password Protect an Expression with Encrypt
Encrypt a message using the simple password "Shiver me timbers!", yielding an EncryptedObject.
In[1]:=
![Click for copyable input](assets.en/password-protect-an-expression-with-encrypt/In_22.png)
secretMessage =
Encrypt["Shiver me timbers!", "I buried a stash of gold somewhere."]
Out[1]=
![](assets.en/password-protect-an-expression-with-encrypt/O_17.png)
The data is now encrypted.
In[2]:=
![Click for copyable input](assets.en/password-protect-an-expression-with-encrypt/In_23.png)
InputForm[secretMessage]
Out[2]//InputForm=
![](assets.en/password-protect-an-expression-with-encrypt/O_18.png)
Decrypt the data using the same password.
In[3]:=
![Click for copyable input](assets.en/password-protect-an-expression-with-encrypt/In_24.png)
Decrypt["Shiver me timbers!", secretMessage]
Out[3]=
![](assets.en/password-protect-an-expression-with-encrypt/O_19.png)