I have tried using this library both directly (in C with MS Visual Studio 2005) and also indirectly - but not much of a success. And I havent found a way how to contact the author!
This is what I have done - might help somebody
BUT
I have found a problem with the encryption routines
It seems they only encrypt up to a particular size.
Has anybody tried to use it/them ? or has any feedback ? or maybe I am doing some stupid mistake ? (wouldnt be the first and I suspect neither will it be the last alas)
Code: Select all
; HASHES
; ======
#MD5_DIGESTSIZE = (128/8)
#MD4_DIGESTSIZE = (128/8)
#MD2_DIGESTSIZE = (128/8)
#RMD128_DIGESTSIZE = (128/8)
#RMD160_DIGESTSIZE = (160/8)
#RMD256_DIGESTSIZE = (256/8)
#RMD320_DIGESTSIZE = (320/8)
#SHA0_DIGESTSIZE = (160/8)
#SHA1_DIGESTSIZE = (160/8)
#SHA256_DIGESTSIZE = (256/8)
#SHA384_DIGESTSIZE = (384/8)
#SHA512_DIGESTSIZE = (512/8)
#WHIRLPOOL_DIGESTSIZE = (512/8)
#TIGER_DIGESTSIZE = (192/8)
Import "cryptohash.lib"
md5init () As "_MD5Init@0"
md5Update ( text$, len.l ) As "_MD5Update@8"
md5Final () As "_MD5Final@0"
HexEncode ( text$, type.l, Out$) As "_HexEncode@12"
HexDecode ( text$, out$ ) As "_HexDecode@8"
rc6init ( text$, len.l ) As "_RC6Init@8"
rc6encrypt ( in$, out$ ) As "_RC6Encrypt@8"
rc6decrypt ( in$, out$ ) As "_RC6Decrypt@8"
xteainit ( text$, type.l ) As "_XTEAInit@8"
xteaencrypt ( in$, out$ ) As "_XTEAEncrypt@8"
xteadecrypt ( in$, out$ ) As "_XTEADecrypt@8"
blowfishinit ( text$, len.l ) As "_BlowfishInit@8"
blowfishencrypt ( in$, out$ ) As "_BlowfishEncrypt@8"
blowfishdecrypt ( in$, out$ ) As "_BlowfishDecrypt@8"
threewayinit ( text$ ) As "_ThreeWayInit@4"
threewayencrypt ( in$, out$ ) As "_ThreeWayEncrypt@8"
threewaydecrypt ( in$, out$ ) As "_ThreeWayDecrypt@8"
EndImport
;key$ = "KeyUsed To Encrypt _+=)( 2000 Needs To Be Very Very Long &^$#@ Especially Since We Will Not Use *() it All aqnd we will also add some garbage at the end"
key$ = "Key Used To Encrypt the various techniques"
text$ = "the string to be encoded man"
out1$ = Space ( 256 )
out2$ = Space ( 256 )
len.l = Len ( key$ )
Debug "===="
Debug "3Way"
Debug "===="
len = Len ( key$ )
;len = 10
threewayinit ( key$ )
Debug "Key: " + key$
threewayencrypt ( text$, out1$ )
Debug "out1: " + out1$
threewaydecrypt ( out1$, out2$ )
Debug "out2: " + out2$
Debug "========"
Debug "BlowFish"
Debug "========"
len = Len ( key$ )
;len = 10
blowfishinit ( key$, len )
Debug "Key: " + key$
blowfishencrypt ( text$, out1$ )
Debug "out1: " + out1$
blowfishdecrypt ( out1$, out2$ )
Debug "out2: " + out2$
Debug "==============="
Debug "MD5 / HexEncode"
Debug "==============="
md5Init ()
md5Update ( key$, len )
*ptr = MD5Final ()
temp.s = PeekS ( *ptr )
Debug "temp: " + temp
HexEncode ( Key$, len, out1$ )
Debug "out1: " + out1$
Debug "==="
Debug "rc6"
Debug "==="
test.s = "LetsSeeIfThisWorks00"
rc6init ( test, Len (test) )
rc6encrypt ( "My test encryption too", out1$ )
Debug "out1: " + out1$
rc6decrypt ( out1$, out2$ )
Debug "out2: " + out2$
Debug "Key Again: " + key$
Debug "===="
Debug "XTEA"
Debug "===="
len = 8
xteainit ( key$, len )
xteaencrypt ( text$, out1$ )
xteadecrypt ( out1$, out2$ )
Debug "out1: " + out1$
Debug "out2: " + out2$
cheers
KingLestat