I did a tutorial on this site and came up with these scripts from it. I thought some of you might find them useful. 3 scripts in the next 3 messages!
The details are in the scripts.
-- this script will encrypt a word, a sentence, or multiple sentences.
(*======DISCLAIMER=======*)
-- I found this technique at http://macscripter.net/articles/197_0_10_29_C/
-- You should read that article to learn what this script does
-- text from the article says:
(*While there is no such thing as a 100% secure encryption method, the particular method I will talk about is very basic and the security of it is minimal. It should be accepted for introductory and educational purposes only. If you want to be able to send semi-sensitive emails that can only be read by someone with the "key" to decipher the message, this will suffice. If you are sending sensitive information, like credit card numbers or financial statements you definitely should not use this method. The average person is not going to be able to crack messages encrypted with this formula but someone with even rudimentary knowledge of code breaking probably can so use this method at your own risk.*)
(*======IMPORTANT=======*)
-- In choosing a value for the multiplier and choosing a character list, the multiplier and the modulus (i.e. the count of the character list) must be "relatively prime."
--Two numbers are said to be relatively prime when the only factor they have in common is 1.
-- I have included a script to help you check for relatively prime numbers.
(*======MY NOTES=========*)
-- You set your encryption methods apart from others by choosing different multipliers and character lists
-- You can even vary the order of the characters in your character list to change things up
-- You need to know the multiplier and the exact character list used to encrypt a message if you want to decrypt it
(*Note at the end of my charList I have the letter "a"... it's a duplicate of the "a" I have earlier in the list. I have this duplicate "a" because in my testing I found that if one of the characters in my "words_to_encrypt" was the last letter in charList then I got an error. The error was because the mod function returned 0 (zero) when it tried to encrypt that letter, and this zero caused an error in another part of the script... therefore I found that adding a duplicate letter at the end of charList solved this problem*)
(*======What you need to supply to the script=========*)
set words_to_encrypt to "I want to encrypt sentences. Not just words!"
set multiplier to 5
set charList to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "{", "}", "|", ":", "\"", "<", ">", "?", "`", "-", "=", "[", "]", "\\", ";", "'", ",", ".", "/", "a"}
considering case
--get a list of numbers for the words corresponding to the item numbers of the characters in charList
set p_letter_list to text items of words_to_encrypt
set p_num_list to {}
repeat with i from 1 to (count of p_letter_list)
set this_letter to item i of p_letter_list
repeat with j from 1 to count of charList
set this_char to item j of charList
if this_letter is this_char then
set end of p_num_list to j
exit repeat
end if
end repeat
end repeat
--encrypt the numbers
set modulus to count of charList
set c_num_list to {}
repeat with i from 1 to (count of p_num_list)
set p_num to item i of p_num_list
set c_num to ((p_num * multiplier) mod modulus)
set end of c_num_list to c_num
end repeat
--get the characters for the encrypted numbers corresponding to the characters in charList
set c_letter_list to {}
repeat with i from 1 to (count of c_num_list)
set this_item to item i of c_num_list
set end of c_letter_list to (item this_item of charList)
end repeat
--coerce the encrypted characters into a string
set c_string to c_letter_list as string
end considering
→ this is the encrypted result → “|Ase^dAd_Ay^o\C:dA/y^dy^oy/-Ah_dAXi/dAs_\t/K”