Crypt implementation for iMessage
Download the shortcut. Make sure it is attached to the share sheet. Make sure you have iCloud Drive enabled.
This is an iMessage-only implementation of my other shortcut, Crypt. Crypt is meant to provide a sort of encryption for simple messages. Say you want to send someone a text message without someone else being able to read it. You can use this shortcut to send a string of numbers containing the message.
To encrypt a message with iMessage-Crypt, either activate the shortcut without input from the share sheet, or just run the shortcut through Shortcuts.app. You will be asked to provide a string message. Once it is encrypted, the shortcut will create a zip file and save it to /Shortcuts/iMessage-Crypt/ in iCloud Drive with the following contents:
txt.txt (contains encoded message string, encoded again with base64)
m4a.m4a (an audio file of Apple's notification ding. It's metadata contains the key encoded with base64 in the Artist field. The rest of the fields are filled with a random base64 encode)
This zip is then sent through iMessage, but you'll need to specify who to send it to. All files related to the zip are deleted after the iMessage is successfully sent.
To decrypt, select the zip file sent to you in iMessage and open the share sheet. Activate iMessage-Crypt from there.
Decryption is done in reverse, with the shortcut extracting the archive and reading the content of both extracted files. The text and artist metadata are both base64 decoded, and used to recreate the unencrypted message.
This shortcut was based off of the concept of OTP (One Time Pad), so each letter of message is randomly altered; this shortcut uses simple math. As I have not extensively studied encryption methods, I could be completely wrong about OTP. The shortcut seems to work anyway.
The TLDR of the mechanism:
Split message into letters, spaces, basic punctuation
Assign numeric value to each split item (ASCII)
Randomly generate number as key
Add said random key to aforementioned number
Encode key and final encoded message with base64
Save encoded key to txt.txt
Create an audio file with the encoded message as metadata
Zip both files into an archive
For example, let's encrypt the string "hello". The shortcut will split each letter apart, creating a list of
h e l l o
Each character is then converted to ASCII, which becomes
104 101 105 105 111
For each number, a random "key" is generated, which is a random integer from 2 to 750, wihch is then added to the number in the ASCII list. If for example our keys were generated as
1 2 1 3 4
then our final encrypted message is:
104 + 1 = 105 101 + 2 = 103 105 + 1 = 106 105 + 3 = 108 111 + 4 = 115
Then the encrypted message and the key are combined with colons and exported.
encrypted message = 105:103:106:108:115 final key = 1:2:1:3:4
To decrypt, run the process in reverse.
105 - 1 = 104 = h 103 - 2 = 101 = e 106 - 1 = 105 = l 108 - 3 = 105 = l 115 - 4 = 111 = o
Latest Release Notes
0.2 - April 14, 2022, 3:18 p.m.
Finished encoding for metadata of the audio file