Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -5,28 +5,28 @@ lowerAlphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|||
upperAlphabet := "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
caesarEncrypt(ch, key) :=
|
||||
let
|
||||
correctAlphabet :=
|
||||
lowerAlphabet when some(ch = lowerAlphabet)
|
||||
else
|
||||
upperAlphabet;
|
||||
|
||||
index := Sequence::firstIndexOf(correctAlphabet, ch);
|
||||
|
||||
newIndex := (index + key - 1) mod 26 + 1;
|
||||
in
|
||||
ch when not(some(ch = lowerAlphabet) or some(ch = upperAlphabet))
|
||||
else
|
||||
correctAlphabet[newIndex];
|
||||
|
||||
let
|
||||
correctAlphabet :=
|
||||
lowerAlphabet when some(ch = lowerAlphabet)
|
||||
else
|
||||
upperAlphabet;
|
||||
|
||||
index := Sequence::firstIndexOf(correctAlphabet, ch);
|
||||
|
||||
newIndex := (index + key - 1) mod 26 + 1;
|
||||
in
|
||||
ch when not(some(ch = lowerAlphabet) or some(ch = upperAlphabet))
|
||||
else
|
||||
correctAlphabet[newIndex];
|
||||
|
||||
caesarDecrypt(ch, key) := caesarEncrypt(ch, 26 - key);
|
||||
|
||||
main(args(2)) :=
|
||||
let
|
||||
key := Conversion::stringToInt(args[2]);
|
||||
encrypted := caesarEncrypt(args[1], key);
|
||||
decrypted := caesarDecrypt(encrypted, key);
|
||||
in
|
||||
"Input: \t" ++ args[1] ++ "\n" ++
|
||||
"Encrypted:\t" ++ encrypted ++ "\n" ++
|
||||
"Decrypted:\t" ++ decrypted;
|
||||
let
|
||||
key := Conversion::stringToInt(args[2]);
|
||||
encrypted := caesarEncrypt(args[1], key);
|
||||
decrypted := caesarDecrypt(encrypted, key);
|
||||
in
|
||||
"Input: \t" ++ args[1] ++ "\n" ++
|
||||
"Encrypted:\t" ++ encrypted ++ "\n" ++
|
||||
"Decrypted:\t" ++ decrypted;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue