Vigenère cipher: Difference between revisions
Content added Content deleted
Recombinant (talk | contribs) (Add Zig solution) |
|||
Line 1,037: | Line 1,037: | ||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
The output is the same. |
The output is the same. |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight lang="easylang"> |
|||
proc encr txt$ pw$ d . r$ . |
|||
r$ = "" |
|||
txt$[] = strchars txt$ |
|||
for c$ in strchars pw$ |
|||
pw[] &= strcode c$ - 65 |
|||
. |
|||
for c$ in txt$[] |
|||
c = strcode c$ |
|||
if c >= 97 |
|||
c -= 32 |
|||
. |
|||
if c >= 65 and c <= 97 |
|||
pwi = (pwi + 1) mod1 len pw[] |
|||
c = (c - 65 + d * pw[pwi]) mod 26 + 65 |
|||
r$ &= strchar c |
|||
. |
|||
. |
|||
. |
|||
s$ = "Beware the Jabberwock, my son! The jaws that bite, the claws that catch!" |
|||
pw$ = "VIGENERECIPHER" |
|||
call encr s$ pw$ 1 r$ |
|||
print r$ |
|||
call encr r$ pw$ -1 r$ |
|||
print r$ |
|||
</syntaxhighlight> |
|||
=={{header|Elena}}== |
=={{header|Elena}}== |