Caesar cipher: Difference between revisions

Content added Content deleted
(→‎Insitux: implementation)
m (Fix misspellings of Caesar.)
Line 3,197: Line 3,197:
</syntaxhighlight>
</syntaxhighlight>
=={{header|Forth}}==
=={{header|Forth}}==
<syntaxhighlight lang="forth">: ceasar ( c n -- c )
<syntaxhighlight lang="forth">: caesar ( c n -- c )
over 32 or [char] a -
over 32 or [char] a -
dup 0 26 within if
dup 0 26 within if
Line 3,203: Line 3,203:
else 2drop then ;
else 2drop then ;


: ceasar-string ( n str len -- )
: caesar-string ( n str len -- )
over + swap do i c@ over ceasar i c! loop drop ;
over + swap do i c@ over caesar i c! loop drop ;
: ceasar-inverse ( n -- 'n ) 26 swap - 26 mod ;
: caesar-inverse ( n -- 'n ) 26 swap - 26 mod ;


2variable test
2variable test
s" The five boxing wizards jump quickly!" test 2!
s" The five boxing wizards jump quickly!" test 2!


3 test 2@ ceasar-string
3 test 2@ caesar-string
test 2@ cr type
test 2@ cr type


3 ceasar-inverse test 2@ ceasar-string
3 caesar-inverse test 2@ caesar-string
test 2@ cr type</syntaxhighlight>
test 2@ cr type</syntaxhighlight>

=={{header|Fortran}}==
=={{header|Fortran}}==
{{works with|Fortan 90 and later}}
{{works with|Fortan 90 and later}}