Wolfram Language

Systems-Level Functionality

Encrypt and Store a Treasure Map on the Cloud

Any Wolfram Language expression can be encrypted.

Generate a strong symmetric key derived from a secret password using the Blowfish method.

In[1]:=
Click for copyable input
skeletonKey = GenerateSymmetricKey["Avast ye!", Method -> "Blowfish"]
Out[1]=

Encrypt the location of the treasure, stored in a GeoMarker and visualized using GeoGraphics, using the generated key.

show complete Wolfram Language input
In[2]:=
Click for copyable input
treasureMap = GeoGraphics[{GeoMarker[GeoPosition[{15.9429, -86.5031}], Text[Style["x", FontFamily -> "Bradley Hand", FontSize -> 24]]]}, FrameLabel -> "Where the Gold is Buried", Frame -> True, ImageSize -> 300, GeoBackground -> "StreetMapNoLabels"]
Out[2]=
In[3]:=
Click for copyable input
hiddenTreasure = Encrypt[skeletonKey, treasureMap]
Out[3]=

Now that the data is safely encrypted using a local key, upload the map to the Wolfram Cloud.

In[4]:=
Click for copyable input
stowed = CloudPut[hiddenTreasure]
Out[4]=

In order to cover the tracks, discard the original map and key using Clear.

In[5]:=
Click for copyable input
Clear[hiddenTreasure]
In[6]:=
Click for copyable input
Clear[skeletonKey]

Since the key was derived using a password, you can create a new key using the original input.

In[7]:=
Click for copyable input
newKey = GenerateSymmetricKey["Avast ye!", Method -> "Blowfish"]
Out[7]=

The new key can now be used to reference the cloud-deployed map.

In[8]:=
Click for copyable input
reclaimedMap = Decrypt[newKey, CloudGet[stowed]]
Out[8]=

Extract the location of the treasure.

In[9]:=
Click for copyable input
treasureLocation = reclaimedMap[[3, 2]]
Out[9]=

Ask for driving directions.

In[10]:=
Click for copyable input
TravelDirections[{$GeoLocation, treasureLocation}]
Out[10]=

As there is no driving route to the treasure, compute its distance using GeoDistance.

In[11]:=
Click for copyable input
GeoDistance[$GeoLocation, treasureLocation]
Out[11]=

Given the distance, locate the nearest airport to the treasure.

In[12]:=
Click for copyable input
airport = First[GeoNearest["Airport", treasureLocation]]
Out[12]=

The distance from that airport to the treasure.

In[13]:=
Click for copyable input
GeoDistance[airport, treasureLocation]
Out[13]=

Related Examples

de es fr ja ko pt-br ru zh