45 lines
1.3 KiB
Text
45 lines
1.3 KiB
Text
[ stack ] is encryption ( --> s )
|
|
[ stack ] is decryption ( --> s )
|
|
|
|
[ [] 95 times [ i^ join ]
|
|
shuffle encryption put ] is makeencrypt ( --> )
|
|
|
|
[ encryption share
|
|
0 95 of swap
|
|
witheach
|
|
[ i^ unrot poke ]
|
|
decryption put ] is makedecrypt ( --> )
|
|
|
|
[ makeencrypt makedecrypt ] is makekeys ( --> )
|
|
|
|
[ witheach [ char ! + emit ] ] is echokey ( s --> )
|
|
|
|
[ encryption release
|
|
decryption release ] is releasekeys ( --> )
|
|
|
|
[ [] swap witheach
|
|
[ dup char ! char ~ 1+
|
|
within if
|
|
[ char ! -
|
|
encryption share
|
|
swap peek char ! + ]
|
|
join ] ] is encrypt ( $ --> $ )
|
|
|
|
[ [] swap witheach
|
|
[ dup char ! char ~ 1+
|
|
within if
|
|
[ char ! -
|
|
decryption share
|
|
swap peek char ! + ]
|
|
join ] ] is decrypt ( $ --> $ )
|
|
|
|
randomise
|
|
makekeys
|
|
say "Encryption key is: " encryption share echokey cr
|
|
say "Decryption key is: " decryption share echokey cr
|
|
cr
|
|
$ "Encryption matters, and it is not just for spies and philanderers."
|
|
say "Plaintext: " dup echo$ cr
|
|
say "Encrypted: " encrypt dup echo$ cr
|
|
say "Decrypted: " decrypt echo$ cr
|
|
releasekeys
|