\ fybb.fs
\ File Encryption System. Currently a WIP
\ Version 2025-12-09. Copyright Gan Uesli Starling
\ License: None. Free for all uses

0 [IF] FYI Notes...

  This file, "fybb.fs", is the top-main file heading a series of others, which
  are called via "INCLUDED". The entirety form a data-encryption program. FYBB
  is an acronym wherein I cock a snook at Big Brother.

  How it works is best described as a "periodically turbulent" streaming cipher
  suited for use on files but probably not streaming data.

  Naming conventions: "LIKE-THIS" for Forth Core words. Otherwise...
    "LIKE_THIS" for constants
    "like_this" for values, variables, arrays, etc.
    "like.this" for routines.

  Find testing words grouped at bottom of most files.

[THEN]

\ BEGIN MAIN DEFS

240 CELLS VALUE x_size \ Divisible by 6 for UU encode, and by 5 for Baudot.

\ Buffer for data. Extra cell at end for overshoot during bit-rolling.
CREATE x_buff x_size 1 CELLS + ALLOT ALIGN

\ An equal size pad for 'move' operations when byte-rolling.
CREATE x_pad x_size ALLOT ALIGN

 0 VALUE x_ofst  \ Offset from 0th addr
12 VALUE x_span  \ Width of sub-arry
 3 VALUE x_iter  \ Iterations and other uses

 0 VALUE fybb_flg \ Input file is *.fybb, so DE-crypt. Else EN-crypt.

\ This one first! Give full path on YOUR OWN system.
S" D:/FYBB/edit_me.fs" INCLUDED \ Edit this for file paths on YOUR OWN system.

\ Load order matters
S" defs.fs"        include.file \ Some general user definitions
S" CWD.fs"   	   include.file \ Which Forth is this, etc?
S" hash.fs"        include.file \ Defs for hashes
S" crc16.fs"       include.file \ CRC-16 XMODEM & CCITT
S" kybd.fs"        include.file \ Defs for keyboard
S" file.fs"        include.file \ Defs for files
S" arry.fs"        include.file \ Defs for arrays
S" grey.fs"        include.file \ Defs to translate Grey code
S" roll.fs"        include.file \ Defs to roll bits
S" shfl.fs"        include.file \ Defs to shuffle bits
S" swap.fs"        include.file \ Defs to swap bits around
S" xor.fs"         include.file \ Defs to XOR bits
S" hop.fs"         include.file \ Defs to randomize use of some above
S" rc4.fs"         include.file \ Rivest's stream-cypher
S" dec_to_bin.fs"  include.file \ Decimal strings to binary arrays
S" math.fs"        include.file \ Big integer math
S" bin_to_bcd.fs"  include.file \ Binary arrays to decimal strings
S" rsa.fs"         include.file \ RSA encryption
S" keys.fs"        include.file \ Generate and mangle an encryption key
S" radx.fs"        include.file \ Translate 5-bit Baudot or 7-bit UU-Encode

\ TESTING

TRUE [IF] \ Make false for normal, true for testing new loaded module file.

keep.going?

PAGE
get.input.path
keep.going?

PAGE
get.partial.key
keep.going?

[THEN] \ End of file
