Page 1 of 1
ASM lib with crytographic, hash, and checksum algorithms
Posted: Tue Jun 20, 2006 4:32 pm
by gnozal
Could be interesting (not tested).
Description:
Functions for number of crytographic, hash, and checksum algorithms.
Hashes: md4, md2, rmd128, rmd160, rmd256, rmd320, sha0, sha1, sha256, sha384, sha512, tiger, whirlpool haval, md5
Checksums: crc32, crc16, adler
Ciphers: tea, xtea, rc2, rc4, rc5, rc6, blowfish, 3-Way rijndael, DES
Written in ASM, source code included.
Homepage :
http://drizz.t35.com
Download :
http://drizz.t35.com/files/cryptohash.rar
Posted: Wed Jan 31, 2007 4:10 pm
by kinglestat
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
Posted: Wed Jan 31, 2007 4:13 pm
by Kaeru Gaman
@KingLestat
please use code-tags...
Posted: Wed Jan 31, 2007 4:18 pm
by kinglestat
how do you use these code blocks ? It is not on the FAQ..so I suggest you add a topic on the FAQ too about it
cheers
KingLestat
Posted: Wed Jan 31, 2007 4:45 pm
by gnozal
The code tags :
[code]your code[/code]
Posted: Wed Jan 31, 2007 5:06 pm
by Kaeru Gaman
...you can add it pressing the button labelled "Code" on the "Post a reply"-page...
when you have already some code in the post, mark the whole code and press the button,
then both tags start + end will be added around the marked text.
(same applies to all Tag-Buttons)
Posted: Wed Jan 31, 2007 8:40 pm
by kinglestat
Posted: Wed Jan 31, 2007 8:50 pm
by Kaeru Gaman
fine.
now click on "edit" at your above post, mark the complete code and TAG it...

Posted: Thu Feb 01, 2007 8:32 pm
by kinglestat
you know I never thought I could modify my own post
I am way out stuck in the dark ages!
thanks for the help
but anybody actually try it out?!!!
My actual question ?
Posted: Thu Jun 04, 2009 11:14 pm
by PBUser
404 Not Found.
Could someone reup this library please?
Thanks!
Posted: Thu Jun 04, 2009 11:21 pm
by ts-soft
Posted: Mon Jun 08, 2009 11:05 am
by JCV
I have compiled a lib with all hash functions before.
http://www.purebasic.fr/english/viewtop ... 21&start=0
Thanks for the the link.

I'll post a working lib and combine it to my library later.
edit:
The hash functions seems to work fine. Doing on encryption routines. Im having trouble on unicode.
@kinglestat
It work that way because these are block ciphers.
If block size for example 128 bits (16 bytes) and yours is 18 bytes, you must pad it. Etc. Adding bytes etc.
Worth to read
http://en.wikipedia.org/wiki/Block_ciph ... _operation
Posted: Sun Aug 16, 2009 7:47 am
by kinglestat
yes and figured that out some time ago
but had forgotten the post
They have all become part of my libs...in C and PB
Quite fast I have to say
cheers
Re: ASM lib with crytographic, hash, and checksum algorithms
Posted: Wed Jun 08, 2011 10:06 pm
by SebastianJu2
I downloaded the DE-File but I dont have a clue how i could use it to hash SHA256 with it. Can someone please explain how to implement it?
Thanks!
Sebastian