Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Substitution-cipher/Arturo/substitution-cipher-1.arturo
Normal file
21
Task/Substitution-cipher/Arturo/substitution-cipher-1.arturo
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
key: {:]kYV}(!7P$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs"v*N[#wSl9zq2^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\C1yxJ:}
|
||||
|
||||
encode: function [str][
|
||||
bs: new []
|
||||
loop split str 'ch ->
|
||||
'bs ++ to :string key\[(to :integer to :char ch)-32]
|
||||
return join bs
|
||||
]
|
||||
|
||||
decode: function [str][
|
||||
bs: new []
|
||||
loop split str 'ch ->
|
||||
'bs ++ to :string to :char (index key ch)+32
|
||||
return join bs
|
||||
]
|
||||
|
||||
s: "The quick brown fox jumps over the lazy dog, who barks VERY loudly!"
|
||||
|
||||
enc: encode s
|
||||
print ["encoded:" enc]
|
||||
print ["decoded:" decode enc]
|
||||
27
Task/Substitution-cipher/Arturo/substitution-cipher-2.arturo
Normal file
27
Task/Substitution-cipher/Arturo/substitution-cipher-2.arturo
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
alfabeto := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
codebeto := "VsciBjedgrzyHalvXZKtUPumGfIwJxqOCFRApnDhQWobLkESYMTN"
|
||||
textToEncode := "Encrypt an input/source file by replacing every upper/lower case alphabets of the source file with another predetermined upper/lower case alphabets or symbols and save it into another output/encrypted file and then again convert that output/encrypted file into original/decrypted file. This type of Encryption/Decryption scheme is often called a Substitution Cipher."
|
||||
|
||||
loop,parse,textToEncode
|
||||
{
|
||||
posit := InStr(alfabeto,a_loopfield,1)
|
||||
if posit
|
||||
textEncoded .= substr(codebeto,posit,1)
|
||||
else
|
||||
textEncoded .= A_LoopField
|
||||
}
|
||||
msgbox % "ENCODED TEXT: " . textEncoded
|
||||
|
||||
loop,parse,textEncoded
|
||||
{
|
||||
posit := InStr(codebeto,a_loopfield,1)
|
||||
if posit
|
||||
textDecoded .= substr(alfabeto,posit,1)
|
||||
else
|
||||
textDecoded .= A_LoopField
|
||||
}
|
||||
msgbox % "DECODED TEXT: " . textDecoded
|
||||
ExitApp
|
||||
|
||||
~Esc::
|
||||
ExitApp
|
||||
Loading…
Add table
Add a link
Reference in a new issue