Caesar cipher: Difference between revisions
Content added Content deleted
imported>Jcubic (correct the code that given wrong results) |
(Added Easylang) |
||
Line 2,427: | Line 2,427: | ||
Encrypted: Ufhp rd gtc bnym knaj itejs qnvztw ozlx. |
Encrypted: Ufhp rd gtc bnym knaj itejs qnvztw ozlx. |
||
Decrypted: Pack my box with five dozen liquor jugs.</pre> |
Decrypted: Pack my box with five dozen liquor jugs.</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
func$ crypt str$ key . |
|||
for c$ in strchars str$ |
|||
c = strcode c$ |
|||
if c >= 65 and c <= 90 |
|||
c = (c + key - 65) mod 26 + 65 |
|||
elif c >= 97 and c <= 122 |
|||
c = (c + key - 97) mod 26 + 97 |
|||
. |
|||
enc$ &= strchar c |
|||
. |
|||
return enc$ |
|||
. |
|||
enc$ = crypt "Rosetta Code" 4 |
|||
print enc$ |
|||
print crypt enc$ -4 |
|||
</syntaxhighlight> |
|||
=={{header|EDSAC order code}}== |
=={{header|EDSAC order code}}== |
||
The EDSAC had only upper-case letters, which were represented by 5-bit codes. |
The EDSAC had only upper-case letters, which were represented by 5-bit codes. |
||
Line 2,669: | Line 2,688: | ||
ENTER MESSAGE |
ENTER MESSAGE |
||
</pre> |
</pre> |
||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |
||
<syntaxhighlight lang="eiffel"> |
<syntaxhighlight lang="eiffel"> |