Nanoka (2005-01-05)

Random block cipher.

Nanoka usage:

   nanoka <keyfile> <e|d> <infile> <outfile>

   <keyfile>   File containing encryption/decryption key.
   <e|d>       Specify encrypt (e) or decrypt (d) mode.
   <infile>    Input file.
   <outfile>   Output file.

   To encrypt a message:

      ./nanoka key.txt e plaintext.txt ciphertext.txt

   To decrypt a message:

      ./nanoka key.txt d ciphertext.txt plaintext.txt

Nanoca usage:

   nanoca <keyfile> [-e <out.c>] [-d <out.c>] [-t <out.c>] [-g <>]

   <keyfile>   File containing encryption/decryption key.

               Key file can be any file of any finite size.  Both the
               sender and receiver need to agree on the same key file.
               Thus /dev/random won't work because it's not
               reproducible, and it's not of finite size.  /dev/null
               is a valid key, though.

   -e <out.c>  Write C encoder source to <out.c>
   -d <out.c>  Write C decoder source to <out.c>

               Output program will take arguments <infile> <outfile>,
               and takes no other arguments -- keys are embedded in
               the source file itself.  These files should never be
               exchanged, given either the encoder source and the
               decoder source can be generated easily and vice versa.

               Encoder adds padding and initialization vector for
               cipher block chaining, thus the encrypted file is
               always larger than the original file.

               To compile encoder/decoder on big-endian machines,
               define BIG_ENDIAN.  The logic should work but I don't
               have a big endian machine to test.  To be safe, only
               transmit messages between machines of the same

   -t <out.c>  Write C diffusion test source to <out.c>

               Output program takes two arguments, number of threads
               and number of seconds to run.  Statistics are printed
               at the end.

               Bias - difference between 0.5 and the probability of
               ciphertext bits changing, for any one bit change in the
               plaintext.  The closer to zero this number is, the
               better the cipher.

               Entropy - general randomness in output frequencies.
               The higher this number is (8 maximum), the better the

   -g <> Write Feistel network graph to <>

               Allow you to visually see the complexity of the
               generated ciphers.  You will need a PostScript viewer
               for this.

   To encrypt a message:

      ./nanoca key.txt -e enc.c
      gcc enc.c -o enc
      rm enc.c
      ./enc plaintext.txt ciphertext.txt

   To decrypt a message:

      ./nanoca key.txt -d dec.c
      gcc dec.c -o dec
      rm dec.c
      ./dec ciphertext.txt plaintext.txt


   Nanoka is an encryption/decryption utility, different from most
   other such utilities in that the internal structures are random.
   Instead of trying to find keys to a known cipher, an attacker would
   have to figure out the internals of the cipher itself.

   Nanoca is a random block cipher generator.  Basically both Nanoka
   and Nanoca use the same random core, except Nanoka interprets it at
   run time while Nanoca dumps it to disk.  Those with access to C
   compilers should use Nanoca, since the encryption/decryption
   process will be *much* faster (like about 40 times faster).

   The structure used is a random Feistel network, operated in cipher
   block chaining mode.  Details on generation of the Feistel network
   can be found in source/design.txt

   ... there is one place in computer science where random code is
   still highly desirable ^_^;

   Program named after Nanoka (Nanoca Flanka), the inventor girl from
   "Aoi Umi no Tristia".


   This software is not for commercial use... if you want to pay me
   for it then please talk to me about it ^_^;

   This software is also not for use outside of the United States due
   to US crypto export laws.  I have submitted TSU notifications to
   BIS and NSA and have yet to hear back from them.  Until then, don't
   get me in trouble, especially if you are a in a country that the US
   doesn't like.

-- -