Examples

1. Real time sample for hash and cipher

2. Example test on the Server Side using ASP

3. Example using it on the client side ( interactive mode )

Example list for the IIS using ASP

<%
dim Crypt, TestCipher, TestCipherEnCoded, MyKey

'CONSTANTS

' //Hash
const csHash_MD4 = 0
const csHash_MD5 = 1
const csHash_SHA = 2
const csHash_SHA1 = 3
const csHash_RipeMD128 = 4
const csHash_RipeMD160 = 5
const csHash_RipeMD256 = 6
const csHash_RipeMD320 = 7
const csHash_Haval128 = 8
const csHash_Haval160 = 9
const csHash_Haval192 = 10
const csHash_Haval224 = 11
const csHash_Haval256 = 12
const csHash_Sapphire128 = 13
const csHash_Sapphire160 = 14
const csHash_Sapphire192 = 15
const csHash_Sapphire224 = 16
const csHash_Sapphire256 = 17
const csHash_Sapphire288 = 18
const csHash_Sapphire320 = 19
const csHash_Snefru = 20
const csHash_Square = 21
const csHash_Tiger = 22
' // Checksums
const csHash_XOR16 = 64
const csHash_XOR32 = 65
const csHash_CRC16_CCITT = 66
const csHash_CRC16_Standard = 67
const csHash_CRC32 = 68
' // Cipher
const csCipher_3Way = 128
const csCipher_Blowfish= 129
const csCipher_Gost = 130
const csCipher_IDEA = 131
const csCipher_Q128 = 132
const csCipher_SAFER_K40 = 133
const csCipher_SAFER_SK40 = 134
const csCipher_SAFER_K64 = 135
const csCipher_SAFER_SK64 = 136
const csCipher_SAFER_K128 = 137
const csCipher_SAFER_SK128 = 138
const csCipher_SCOP = 139
const csCipher_Shark = 140
const csCipher_Square = 141
const csCipher_TEA = 142
const csCipher_TEAN = 143
const csCipher_Twofish = 144
const csCipher_Cast128 = 145
const csCipher_Cast256 = 146
const csCipher_1DES = 147
const csCipher_2DES = 148
const csCipher_2DDES = 149
const csCipher_3DES = 150
const csCipher_3DDES = 151
const csCipher_3TDES = 152
const csCipher_DESX = 153
const csCipher_Diamond2 = 154
const csCipher_Diamond2Lite = 155
const csCipher_FROG = 156
const csCipher_Mars = 157
const csCipher_Misty = 158
const csCipher_NewDES = 159
const csCipher_RC2 = 160
const csCipher_RC4 = 161
const csCipher_RC5 = 162
const csCipher_RC6 = 163
const csCipher_Rijndael = 164
const csCipher_Sapphire = 165
' Cipher Modes
const cmCTS = 0
const cmCBC = 1
const cmCFB = 2
const cmOFB = 3
const cmECB = 4
const cmCTSMAC = 5
const cmCBCMAC = 6
const cmCFBMAC = 7
' Format Objects
const fmtNone = -1
const fmtCopy = 0
const fmtHEX = 1
const fmtMIME64 = 2
const fmtUU = 3
const fmtXX = 4
' HashTipe
const HashString= 0
const HashFILE = 1

set Crypt = server.createobject("aspCrypt.EasyCRYPT")

response.Write "<p><b>" + Crypt.Version + "</b></p>"

' Hash a String
TestHash = "This string will be hashed"
response.Write "<b>Start a Hash Test of '" + TestHash + "'</b><br>"
Crypt.Algorithm = csHash_MD5
response.Write "Algorith Desc: " + Crypt.Description + "<br>"
Crypt.Counter( -1 )
Crypt.Hash TestHash, HashString
response.Write "Result HEX: " + Crypt.Digest( fmtHEX ) + "<br>"
response.Write "Time: " + Crypt.Counter( 0 ) + "<br>"
response.Write "<br>"

' Hash a File
TestFile = "C:\AUTOEXEC.BAT"
response.Write "<b>Start a Hash / Checksum Test of the File '" + TestFILE + "'</b><br>"
Crypt.Algorithm = csHash_CRC32
response.Write "Algorith Desc: " + Crypt.Description + "<br>"
Crypt.Counter( -1 )
Crypt.Hash TestFile, HashFILE
response.Write "Result HEX: " + Crypt.Digest( fmtHEX ) + "<br>"
response.Write "Time: " + Crypt.Counter( 0 ) + "<br>"
response.Write "<br>"

'Cipher a String
TestCipher = "This string will be Ciphered"
TestCipherEnCoded = ""
MyKey = "This is my secret key"
response.Write "<b>Start a Cipher Test of '" + TestCipher + "'</b><br>"
Crypt.Algorithm = csCipher_Blowfish
Crypt.Mode = cmCTS
response.Write "Algorith Desc: " + Crypt.Description + "<br>"
Crypt.Counter( -1 )
Crypt.initKey( MyKey )
TestCipherEnCoded = Crypt.EnCodeString( TestCipher, fmtNone )
response.Write "CODED: '" + TestCipherEnCoded + "'<br>"
response.Write "CODED: '" + Crypt.Results + "'<br>"

Crypt.initKey( MyKey )
response.Write "DECODED: '" + Crypt.DeCodeString( TestCipherEnCoded, fmtNone ) + "'<br>'"
response.Write "DECODED: '" + Crypt.Results + "'<br>"
response.Write "Time: " + Crypt.Counter( 0 ) + "<br>"
response.Write "<br>"

'Cipher a File
MyKey = "This is my secret key"
response.Write "<b>Start a Cipher Test of a File</b><br>"
Crypt.Algorithm = csCipher_IDEA
Crypt.Mode = cmCTS
response.Write "Algorith Desc: " + Crypt.Description + "<br>"
Crypt.Counter( -1 )
Crypt.initKey( MyKey )
Crypt.EnCodeFile "c:\autoexec.bat", "c:\autoexec.enc"
Crypt.initKey( MyKey )
Crypt.DeCodeFile "c:\autoexec.enc", "c:\autoexec.dec"
response.Write "Time: " + Crypt.Counter( 0 ) + "<br>"
response.Write "<br>"


set Crypt = nothing

%>