Joseph K. Myers

Friday, April 19, 2002

CBF, Circular Binary (Byte) Format

Encryption can be improved by the use of algorithms which add entropy to ordinary data. The CBF encoding process makes every byte dependent on the last, thus creating ambiguity and enabling an increase in speed by allowing a tradeoff in primary formula strength without reducing security.

CBF is not an encryption process. The difference between encryption and encoding is that encoding follows a single determined procedure for every set of input. If the encoding process is lossless, then knowledge of the encoding operation is sufficient to obtain the original message, i.e. decode.

Encryption relies on more than one input, and uses a method to produce output which, even if the algorithm is understood, is not able to be decrypted unless you also possess copies of all pertinent parameters.

An example of an encoding process is Base64 (and also this). PGP and SSL are examples of encryption technology.

CBF cycles through input in a circular fashion (hence the name), using sum and modulus to obtain non-independent byte values. The formula is elementary: b_{-1} = 0; b_{n} = (b_{n-1} + b_{n}) mod 256. A series starting as {100, 100, 100, 100} would end as {100, 200, 44, 144}.

Name choices, cbf and cbx, reflect the idea that 'cb' represents format, with 'f' being cb-format and 'x' chosen as the command counterpart (originally named cbf-x). This way of naming would result in the command gz for gzip, and gx for gunzip. (Of course, those shortcuts might be slightly _too_ short.)

Suggesting 'e' for 'encoding' (e.g. cbe) is redundant, as in a sense every program does encoding. (Besides the fact that "encode" denotes an operation in better English than 'encoding', not to mention that encode would have to come first (e.g. ecb).) Anyway, cbf looks and sounds better.

Oh yeah, gzip and gunzip look and sound better, too. ;-)

All necessary files are available in cbf.tar.gz (468 bytes).

Usage is just like any filter:

cbf [< input] [> output]

cbx [< input] [> output]

The b64/bff tools (see base-64.txt) allow printable text to be made of cbf data, in case you need to transfer the binary output in an unsafe environment (such as through e-mail). For encoding, do:

cbf [< input] | b64 [> output]

and for decoding,

bff [< input] | cbx [> output].

All this results in the series cbf | b64 | bff | cbx, which, as you can see, first encodes in cbf, then in base-64. The base-64 is decoded, and finally, the binary output of cbf.

A "Makefile" is provided for building on UNIX systems, although the process is extremely simple. No installation mechanism is included, but the programs belong in /usr/local/bin.

Performance runs to about 20 MB/sec on this little computer. Other computers *should* work faster. (Another computer ran 1 MB of random input in 0.007 sec.)

http://www.myersdaily.org/joseph/unix/cbf.txt