Ceasar Cipher Using Forth Programming
I will show you how to create a basic Ceasar cipher using the forth programming language (SwiftForth). We will cover encrypting and decrpting a few messages.
Full source code below:
: mymsg ( – len ) pad 20 erase pad 20 accept ;
: ciphershift ( char – shiftedchar ) dup 97 120 within if 3 + else 23 - then ;
: cipherout mymsg ." ->" 0 do pad i + c@ ciphershift emit loop ;
: reveal dup 100 123 within if 3 - else 23 - then ;
: showmsg mymsg ." ->" 0 do pad i + c@ reveal emit loop ;