| ======================================================================== SEA1m5 (2011-09-04) (Simple Encryption Algorithm with MD5-Based Chained Hash Function) ======================================================================== +++ ATTENTION +++ ATTENTION +++ ATTENTION +++ Please take a look on the Successor of the Encryption Algorithm ==> SEA1xm5! I will describe how to use an Linear Congruential Generator for cryptographic Purpose - symmetric Encryption. This is an improved Version of my former Idea of an Encyrption Algorithm named VSPOTP (Vigenere Seeded Pseudo-One-Time-Pad Cipher) A Demo of the Encryption Algorithm (SEA1m5) in JavaScript is currently available, some other Programms for Data-Encryption will follow soon, all of them including the Source-Code. A more detailed Documentation will also follow, for now the JavaScript-Source-Code contains a lot of Comments and Explanation on how the Algorithm works. I suppose the best Way to find out is by giving it a Try. The Lisiting of some important Functions from the JavaScript-SourceCode can be found here or (Download the Source as ZIP-File) # Basic Principle The main Functions of the Encryption Algorithm consist in the following parts 1) A modified use of a regular Linear Congruential Generator (mLCG) feeding now with one Seed (X) and 3 every-time changing Values for the Constants (A, C, M) for every single Encryption, instead of normally using one Seed and three fixed Constants. Long-term Test of the modified LCG (mLCG) showing a very resonable discrete Uniform Distribution of Random-Numbers. Similar to: * http://en.wikipedia.org/wiki/Linear_congruential_generator 2) A simple Hash-Function using MD5-Checksums which are re-hashed over several Rounds as a Key stretching Function. (MD5CHF) Similar to: * http://en.wikipedia.org/wiki/Key_strengthening 3) A Password-Based Random Initialisation Vector Function (PRND_IV) used to create the 4 IV (Values X, A, C, M) for the modified LCG (mLCG), which are in fact nearly similar to "Numbers used once". This function (PRND_IV) will generate the 4 IV (Values X, A, C, M) out of a random ASCII-String and the Password. Both represented by re-hashed MD5-Checksum‘s (MD5CHF) which are XOR enciphered, than split up in Numbers of certain length to initialise the Values X, A, C and M for the modified LCG (mLCG). 4) The Random-String, from which the 4 IV (Values X, A, C, M) are derived, will be XOR encrypted with the salted Password and placed in Front of every encrypted Message. This way we can secretly submit all 4 IV (Values X, A, C, M) for the modified LCG (mLCG) and the Message can be deciphered, if the receiver has Knowledge of the Password. # Encipher Steps (short Description) (** Please find the corresponding Number in the JavaScript-Listing.) (** e1) // Generate a random ASCII-String, build it's MD5-Checksum and pick some Values of it as Password-Salt (** e2) // Generate a random ASCII-String as the Basis for the Password-Based Random Initialisation Vector Function. (PRND_IV) (** e3) // Derive the 4 IV (Values X, A, C, M) from this random ASCII-String using the Password-Based Random Initialisation Vector Function (PRND_IV). This will put the modified LCG (mLCG) into it‘s internal State for creating the Key-Stream. (** e4) // XOR Encipher the HEX-String of Random-IV with the MD5-based Chained Hash (MD5CHF) of the salted Password. The Result will be the Secret-IV. (** e5) // Prepare the Message-Header containing a Marker for the used Version of the Encryption Algorithm, the Value for the MD5-Based Chained Hash Rounds, the HEX-Value of the Password-Salt and finally the HEX-Value of the Secret-IV. (** e6) // Perform the XOR-Encryption of the Data-Stream with the Key-Stream using the formerly under (** e3) created 4 IV (Values X, A, C, M) with the modified LCG (mLCG) until the End of the Data-Stream has been reached. (** e7) // In this JavaScript-Implementation, as we Encipher just a Text, the Message-Header will be placed in Front of the enciphered Message. When using the Encryption Algorithm on binary Data or a Communication-Stream the Message-Header of course needs to be written or send before the actual enciphered Data. # Decipher Steps (short Description) (** Please find the corresponding Number in the JavaScript-Listing.) (** d1) // Check if the enciphered Message has the correct Version, extract the Value for the MD5-Based Chained Hash Rounds and the HEX-Value of the Password-Salt. (** d2) // XOR Decipher the HEX-String of the Secret-IV from the Beginning of the enciphered Message, using the MD5-based Chained Hash (MD5CHF) of the salted Password. The Result will be the Random-IV from which the 4 IV (Values X, A, C, M) will be derived. (**d3) // Now re-generate the 4 IV (Values for X, A, C, M) out of the Random-IV using a Password-Based Random Initialisation Vector Function (PRND_IV). This will put the modified LCG (mLCG) into it's internal State for creating the Key-Stream for Deciphering the Data-Stream. (** d4) // Perform the XOR-Decryption of the Cipher-Stream with the Key-Stream using the formerly under (** d3) re-created 4 IV (Values X, A, C, M) with the modified LCG (mLCG) until the End of the Cipher-Stream has been reached and regain the Data-Stream. A full functional Example of the Encryption Algorithm including Source-Code in JavaScript is available here or (Download the Source as ZIP-File) Cheers, Karl-Uwe ###################################################################### Copyright (c) 2011, Karl-Uwe Frank This Software and it's Encryption Algorithm (SEA1m5) is released under the Non-Profit Open Software License 3.0 (NPOSL-3.0) http:www.opensource.org/licenses/NOSL3.0 This Code and the Encryption Algorithm (SEA1m5) can be used freely for all personal, academic or non-commercial Purposes. For commercial Purposes please contact karl.frank [a T] freecx.co.uk ###################################################################### |