15 lines
411 B
Plaintext
15 lines
411 B
Plaintext
{{
|
|
variable offset
|
|
: rotate ( cb-c ) tuck - @offset + 26 mod + ;
|
|
: rotate? ( c-c )
|
|
dup 'a 'z within [ 'a rotate ] ifTrue
|
|
dup 'A 'Z within [ 'A rotate ] ifTrue ;
|
|
---reveal---
|
|
: ceaser ( $n-$ )
|
|
!offset dup [ [ @ rotate? ] sip ! ] ^types'STRING each@ ;
|
|
}}
|
|
|
|
( Example )
|
|
"THEYBROKEOURCIPHEREVERYONECANREADTHIS" 3 ceaser ( returns encrypted string )
|
|
23 ceaser ( returns decrypted string )
|