|
Rijndael Cipher
Classes
Rijndael
|
RijndaelImplementation of the AES Rijndael Block Cipher. Inspired by Mike Scott’s implementation in C. LicenseThis is ‘free’ software with the following restrictions You may not redistribute this code as a ‘sample’ or ‘demo’. However, you are free to use the source code in your own code, but you may not claim that you created the sample code. It is expressly forbidden to sell or profit from this source code other than by the knowledge gained or the enhanced value added by your own code. Use of this software is also done so at your own risk. The code is supplied as is without warranty or guarantee of any kind. Should you wish to commission some derivative work based on this code provided here, or any consultancy work, please do not hesitate to contact us. About
Summary
encryptData
Use this method to encrypt your data. Parameters
Returns
Exampledim sMessage : sMessage = "This is a very secret message" dim sPassword : sPassword = "Password" dim E, byteMessage, bytePassword, encData set E = new Rijndael byteMessage = E.string2bytes(sMessage) bytePassword = E.string2bytes(sPassword) encData = E.encryptData( byteMessage, bytePassword ) E.gentables Response.write( "Plain Text: " & sMessage & "<br />" ) Response.write( "Encrypted Hex: " & E.bytes2hex( encData ) & "<br />") set E = nothing decryptData
Use this method to decrypt your data. Parameters
Returns
Exampledim sMessage : sMessage = "This is a very secret message" dim sPassword : sPassword = "Password" dim E, byteMessage, bytePassword, encData set E = new Rijndael byteMessage = E.string2bytes(sMessage) bytePassword = E.string2bytes(sPassword) encData = E.encryptData( byteMessage, bytePassword ) E.gentables Response.write( "Plain Text: " & sMessage & "<br />" ) Response.write( "Encrypted Hex: " & E.bytes2hex( encData ) & "<br />") Response.write( "Decrypted: " & E.bytes2string( E.decryptData( encData , bytePassword ) ) ) set E = nothing |
Use this method to encrypt your data.
public function encryptData( bytMessage, bytPassword )
Use this method to decrypt your data.
public function decryptData( bytIn, bytPassword )
Convert strings into an array of bytes.
public function string2bytes( string )
Convert an array of bytes into strings.
public function bytes2string( bytes )
Convert an array of bytes into it’s hex form.
public function bytes2hex( bytes )