http://ysengrin.com

kryptyomic, a library for symmetric stream and file encryption.

Copyright (C) 2000 Guillaume Vareille

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Author:Guillaume Vareille

junk@ysengrin.com
http://ysengrin.com
 

kryptyomic is a library for symmetric stream and file encryption.

each letter of a password up to (256*256 bytes) is used as an unsigned byte
integer value to seed a pseudo-random serie, a simple combo from the public
domain: the period of the combo exceeds 2^60. this combo can be replaced by
any other pseudo random number generator.

each random serie is seeded with a letter of the password plus a pseudo random
number from the previous serie.

these series are used in random order to produce one new pseudo random number,
for the encryption and one to determine the next series to use.
then we use the next series to produce one number, and so on.

the pseudo random series are used to generate a substitution table
this allows the replacement of a two-byte value by its corresponding
unique two-byte value from the substitution table.
(a smaller substitution table of 256 bytes is used where single-byte encoding is necessary).

the stream is considered as a succession of two-byte values.

the value is obtained from the stream:  val0
we generate one two-byte pseudo random number: aTwoByteRandNumber
we xor the value and the pseudo random number: val1 = val0 XOR aTwoByteRandNumber
we take the corresponding value in the grid: val2 = SubstitutionTable [ val1 ]
we xor the value with the same pseudo random number: val3 = val2 XOR aTwoByteRandNumber
we put the value in the output stream.

val0
val1 = val0 XOR aTwoByteRandNumber
val2 = SubstitutionTable [ val1 ]
val3 = val2 XOR aTwoByteRandNumber

note: if we don't do the substitution table step, no encryption is performed.
(ie. if val2 equals val1 then val3 equals val0).

to perform decryption we follow the same method but before running the stream,
we just reverse the substitution table once (such as val1 = ReverseSubstitutionTable[val2])

http://ysengrin.com