Apollo18.Cipher (Apollo18 v1.1.2)

Provides cipher mechanism to make your things be like Apollo 18: Officially don't exists, only the owner know that it (if ?) exists.

The truth is out there (Maybe ...).

This module functionalities are present in web/javascript version. This could be usefull to send/receive messages between a web browser client (Javascript side) and a server (Elixir side). For javascript instantiation use:

let cipher = new Cipher();

Remember of take additional care to handle securely key and salt values when use it whit javascript. Rotate the key each X minutes and store it ciphered for example. If you want maximum security try use one new key per message. Never, never, never use sequential keys, always randomize, please!

Link to this section Summary

Functions

Cipher a text/string object. Each time that a same string is ciphered, the cipher will be another cipher. However when decipher all then will result in same origin string.

Decipher a previously ciphered string that contains a text/string object.

Link to this section Functions

Link to this function

cipher(string, salt \\ 1, key \\ 0)

Cipher a text/string object. Each time that a same string is ciphered, the cipher will be another cipher. However when decipher all then will result in same origin string.

The salt parameter can be used to make more strong the cipher. Increase of processing time is also proportional to this value. By default the minimum value is equal to 1.

Only supported chars will be ciphered. All non supported chars will be removed from original text/string before of cipher process. This could generate some decipher "issues". If you will/need use non supported chars then try use the Apollo18.Based64Cipher module.

Supported chars

  [
    "A","Ä","Ã","Â","Á","À","Æ","А",
    "B","Б","Ъ","Ь","Ы","C","Ç","D","Ð","Д","В","С",
    "E","Ë","Ẽ","Ê","É","È","Э","Е",
    "F","Ф","G","Г","H","Н",
    "I","Ï","Ĩ","Î","Í","Ì",
    "J","Ж","K","К","L","Л",
    "M","М","N","Ñ","И","Й",
    "O","Ö","Õ","Ô","Ó","Ò","Ѳ","О",
    "P","Р","П","Q","R","S","Ш","Щ","T","Т","Þ","Ц","Ч",
    "U","Ü","Ũ","Û","Ú","Ù",
    "V","X","Х","W",
    "Y","Ÿ","Ỹ","Ŷ","Ý","Ỳ","У",
    "Z","З",
    "ẞ","Ю","Я",
    "a","ä","ã","â","á","à","æ","а",
    "b","б","ъ","ь","ы","c","ç","d","ð","д","в","с",
    "e","ë","ẽ","ê","é","è","ə","œ","ɛ","э","е",
    "f","ф","g","г","h","н",
    "i","ï","ĩ","î","í","ì",
    "j","ж","k","к","l","л",
    "m","м","n","ñ","и","й",
    "o","ö","õ","ô","ó","ò","ѳ","о",
    "p","р","п","q","r","s","ш","щ","t","т","þ","ц","ч",
    "u","ü","ũ","û","ú","ù",
    "v","x","х","w",
    "y","ÿ","ỹ","ŷ","ý","ỳ","у",
    "z","з",
    "ß","ю","я",
    "ʃ","ʒ","ʁ","ɾ",
    "Ѣ","ѣ","Ѵ","ѵ",
    "0","1","2","3","4","5","6","7","8","9",
    " ",".",",",";",":","<",">","/","\","?","|",
    "[","]","{","}","(",")","º","°","ª",
    "+","-","=","_","*","&","%","$","#","@",
    "~","^","´","`","§","‘","’","“","”",
    "!","'",""","
","
"," ","",""
  ]

Javascript Example

var cipher = new Cipher(); // or new Based64Cipher(); if you want add a encoding base64 step.
var text = 'аз буки веди Conheço letras. глаголь добро есть Falar é benéfico живете зело земля  Vive de verdade (nesta) terra иже и како люди мыслете   a cal, de onde pensastes como seres humanos наш он покой    é por nossa tranquilidade рцы слово твердо  da palavra firmemente ук ферт хер цы    [daqui em diante...] червь ша ер ять юс';
var key = 223456237;
var salt = 1;
var ciphered = cipher.cipher(text,salt,key);

(ciphered content):
{”[’[’[’[’/§H“/^*§,~#ªH1ª?ª?ª?´[_}_{_:ª?ª?´[_;”?#3.7[8#1.5=2+7[7&9!6&2+7[7<4+0+4?9&3&4+7[6=9&0%6-9@7-8[7[3?7=6#3?1-7=0&7[6&1-8#3-1-7[9!8&1%0&7[2:9@6=9@6-7[3!7[7#9&0+3!0?6?2&4+7[3=2+7&9!1%9!7[3.9!7=1-7[3.9!9=7=6.7[1}3$6?1I9&7[4&9&7[1I9&6-4&9@4&9&7[2(0+9&7-0%9@3(7[0%9&6-6-9@7[2+3=9!7[2+7[5=6#5=1-7[7=5.6&2+7[9=1&8&7=9!1%9!7[1}9@7[2&9@6=9[7[4&9&7[4+0+4&9&7[2-9&0+7-9@7-0%9&7-7[2&4+8=4+7[7-9&6-9&7-7[4?5%8=9@0+4+7-7[5?6#8-7[1-5?7[4-1-5=1-3+7[1}3!7[2-4+6-7[0+4+7-7-9@7[0%6-9@0+5-5%6?6=6?4&9@4&9&7[3-3%1&7[8&7=1-7&1-7[1%7&9!3-6&1-7[1}4&9@7[2-9@6=9@1I6-9@7[0?6?6-8=9&8=9&0+0%9&7[1.5=7[1?9!3-1%7[3I9!3-7[3%1&7[1}8]4&9@5-5%6?7[9&8=7[4&6?9@0+0%9&8[8[8[9]7[4%9!3-7&0&7[8-6#7[9!3-7[6.1%0&7[5.8&

Elixir Examples

iex > Apollo18.Cipher.cipher("mytext",1,345278)
"°(”)´[_;’/_@º!‘+G*4‘?°I§?”.§?”.§?”.§?”.“?”.”?”.G=”.’?”.~=”.0Aª,:6*1H0<3*1H"
iex > Apollo18.Cipher.cipher("mytext",1,345278)
"°(”)_;_;º/`$^H”H`#º+0§?A0§?A0§?A0§?A0“?A0”?A§,°?0’?A`@§,G#5/2@7*6>9$7*"
iex > Apollo18.Cipher.cipher("mytext",1,345278)
"´)´[`<´[’/ª/’/G*5G=§+”?_%”?_%”?_%”?_%~=_%0A_%ª!_%_=_%0D_%0E‘%(6<1}0[3<1}"
iex > Apollo18.Cipher.cipher("mytext",2,345278)
"°(”)´[_:º/`$^H§H´!º%6?3!1+3=1?3!1?3=6H6H9H7H6?1+0*7H1*6H0
 *7H8H6H9H7H8?1+3!3!6H6H1+7H6H6H1+7H6H6H1+7H6H6H1+7H6H6H8H
 8H6H6H9H8H6H6H0*8H6H6H7H8H6H6H2*8H6H6H3*8H8H7+7H8$0*8*9H6
 @4*7$0*8*"
iex > Apollo18.Cipher.cipher("mytext",3,345278)
"§#Fª]E’{°;º/~*`$ºH0‘?E5@9+9$4%6-4+6=4+9$9$9$0@9$9$9$0@9$9
$2@0@6-4%2@0@9+4%3@0@1@9$2@0@4%4%6@1@0@2#8@3#2@2#4@2#3@4!0
@2#9$2#3@4!6@3#6@3#6@3#9$2#6@3#6@3#6@3#6@3#6@3#7@3#0@2#7@3
#0@2#6@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.0)1.2]2.0[0.4.6]0.4.1.3.1]2.0[3.1]2.0[3.1]4
.0[0.4.6]0.4.1.3.1]2.0[3.1]4.0[0.4.6]0.4.1.0.4.6]0.4.1.3.1
]2.0[3.1]4.0[3.1]4.0[0.4.6]0.4.1.3.1]2.0[3.1]5.0[3.1]4.0[0
.4.6]3.6]0.6.2.1.0[3.3]5.0[3.1]1.0[1.1]0.0[0.1]7.0)3.3]9I0
[0.1]1.0[1.2]2.0[3.1]1.0[1.1]0.0[0.1]7.0)3.3]"
Link to this function

decipher(string, salt \\ 1, key \\ 0)

Decipher a previously ciphered string that contains a text/string object.

Should be used the same salt and key values used in call to cipher function.

Javascript Example

var cipher = new Cipher(); // or new Based64Cipher(); if you used it previously to cipher.
var ciphered = '{”[’[’[’[’/§H“/^*§,~#ªH1ª?ª?ª?´[_}_{_:ª?ª?´[_;”?#3.7[8#1.5=2+7[7&9!6&2+7[7<4+0+4?9&3&4+7[6=9&0%6-9@7-8[7[3?7=6#3?1-7=0&7[6&1-8#3-1-7[9!8&1%0&7[2:9@6=9@6-7[3!7[7#9&0+3!0?6?2&4+7[3=2+7&9!1%9!7[3.9!7=1-7[3.9!9=7=6.7[1}3$6?1I9&7[4&9&7[1I9&6-4&9@4&9&7[2(0+9&7-0%9@3(7[0%9&6-6-9@7[2+3=9!7[2+7[5=6#5=1-7[7=5.6&2+7[9=1&8&7=9!1%9!7[1}9@7[2&9@6=9[7[4&9&7[4+0+4&9&7[2-9&0+7-9@7-0%9&7-7[2&4+8=4+7[7-9&6-9&7-7[4?5%8=9@0+4+7-7[5?6#8-7[1-5?7[4-1-5=1-3+7[1}3!7[2-4+6-7[0+4+7-7-9@7[0%6-9@0+5-5%6?6=6?4&9@4&9&7[3-3%1&7[8&7=1-7&1-7[1%7&9!3-6&1-7[1}4&9@7[2-9@6=9@1I6-9@7[0?6?6-8=9&8=9&0+0%9&7[1.5=7[1?9!3-1%7[3I9!3-7[3%1&7[1}8]4&9@5-5%6?7[9&8=7[4&6?9@0+0%9&8[8[8[9]7[4%9!3-7&0&7[8-6#7[9!3-7[6.1%0&7[5.8&';
var key = 223456237;
var salt = 1;
var deciphered = cipher.decipher(text,salt,key);

(deciphered content):
аз буки веди Conheço letras. глаголь добро есть Falar é benéfico живете зело земля  Vive de verdade (nesta) terra иже и како люди мыслете   a cal, de onde pensastes como seres humanos наш он покой    é por nossa tranquilidade рцы слово твердо  da palavra firmemente ук ферт хер цы    [daqui em diante...] червь ша ер ять юс

Elixir Examples

iex > Apollo18.Cipher.decipher("°(”)´[_;’/_@º!‘+G*4‘?°I§?”.§?”.§?”.§?”.“?”.”?”.G=”.’?”.~=”.0Aª,:6*1H0<3*1H",1,345278)
"mytext"
iex > Apollo18.Cipher.decipher("°(”)_;_;º/`$^H”H`#º+0§?A0§?A0§?A0§?A0“?A0”?A§,°?0’?A`@§,G#5/2@7*6>9$7*",1,345278)
"mytext"
iex > Apollo18.Cipher.decipher("´)´[`<´[’/ª/’/G*5G=§+”?_%”?_%”?_%”?_%~=_%0A_%ª!_%_=_%0D_%0E‘%(6<1}0[3<1}",1,345278)
"mytext"