Substitution cipher: Difference between revisions

(→‎{{header|Risc-V}}: update Risc-V -> RISC-V Assembly)
Line 126:
<pre>encoded: 2bu]E,KHm].Tdc|]4d\]),8M>]dQuT]<bu]U31C]Idf_]cbd].3Tm>]+ZzL]Ud,IUCk
decoded: The quick brown fox jumps over the lazy dog, who barks VERY loudly!</pre>
 
=={{Header|AutoHotkey}}==
<syntaxhighlight lang="autohotkey">
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
</syntaxhighlight>
{{Out}}
<pre>
Substitution Cipher.ahk
---------------------------
ENCODED TEXT: BhJbTWk Ih RhWEk/LQEbJq ORnq wT bqWnIJRhC qSqbT EWWqb/nQYqb JILq InWFIwqkL QO kFq LQEbJq ORnq YRkF IhQkFqb WbqxqkqbDRhqx EWWqb/nQYqb JILq InWFIwqkL Qb LTDwQnL Ihx LISq Rk RhkQ IhQkFqb QEkWEk/qhJbTWkqx ORnq Ihx kFqh ICIRh JQhSqbk kFIk QEkWEk/qhJbTWkqx ORnq RhkQ QbRCRhIn/xqJbTWkqx ORnq. tFRL kTWq QO BhJbTWkRQh/iqJbTWkRQh LJFqDq RL QOkqh JInnqx I KEwLkRkEkRQh cRWFqb.
---------------------------
DECODED TEXT: 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.
---------------------------
</pre>
 
=={{header|C}}==
16

edits