Wolfram Mathematica

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]:=
`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]:=
```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]:=
`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]:=
`stowed = CloudPut[hiddenTreasure]`
Out[4]=

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

In[5]:=
`Clear[hiddenTreasure]`
In[6]:=
`Clear[skeletonKey]`

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

In[7]:=
`newKey = GenerateSymmetricKey["Avast ye!", Method -> "Blowfish"]`
Out[7]=

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

In[8]:=
`reclaimedMap = Decrypt[newKey, CloudGet[stowed]]`
Out[8]=

Extract the location of the treasure.

In[9]:=
`treasureLocation = reclaimedMap[[3, 2]]`
Out[9]=

Ask for driving directions.

In[10]:=
`TravelDirections[{\$GeoLocation, treasureLocation}]`
Out[10]=

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

In[11]:=
`GeoDistance[\$GeoLocation, treasureLocation]`
Out[11]=

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

In[12]:=
`airport = First[GeoNearest["Airport", treasureLocation]]`
Out[12]=

The distance from that airport to the treasure.

In[13]:=
`GeoDistance[airport, treasureLocation]`
Out[13]=