Cryptographic Hash Functions Collection (IncludeFile)

Developed or developing a new product in PureBasic? Tell the world about it.
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Cryptographic Hash Functions Collection (IncludeFile)

Post by JCV »

Cryptographic Hash Functions IncludeFile

Includes the following algorithms:
Whirlpool
RIPEMD160
MD2
MD4
MD5
HAVAL256
GOST
SHA
SHA1
SHA224
SHA256
SHA384
SHA512

Sample Use
Global string_sample.= "The quick brown fox jumps over the lazy dog"

Debug PureHash_WhirlpoolFingerprint(@string_sample, Len(string_sample))
Debug PureHash_RIPEMD160Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_MD2Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_MD4Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_MD5Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_HAVAL256Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_GOSTFingerprint(@string_sample, Len(string_sample))
Debug PureHash_SHAFingerprint(@string_sample, Len(string_sample))
Debug PureHash_SHA1Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_SHA224Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_SHA256Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_SHA384Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_SHA512Fingerprint(@string_sample, Len(string_sample))
Debug PureHash_WhirlpoolFileFingerprint("C:\test.log")
Debug PureHash_RIPEMD160FileFingerprint("C:\test.log")
Debug PureHash_MD2FileFingerprint("C:\test.log")
Debug PureHash_MD4FileFingerprint("C:\test.log")
Debug PureHash_MD5FileFingerprint("C:\test.log")
Debug PureHash_GOSTFileFingerprint("C:\test.log")
Debug PureHash_SHAFileFingerprint("C:\test.log")
Debug PureHash_SHA1FileFingerprint("C:\test.log")
Debug PureHash_SHA224FileFingerprint("C:\test.log")
Debug PureHash_SHA256FileFingerprint("C:\test.log")
Debug PureHash_SHA384FileFingerprint("C:\test.log")
Debug PureHash_SHA512FileFingerprint("C:\test.log")
Download:
http://purebasic.jcvsite.com/v4/HashLib.zip

Use at your own risk. :wink:
Last edited by JCV on Wed Sep 17, 2008 5:56 pm, edited 4 times in total.

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Amazing! Thank you!
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Looks very useful indeed, thank you very much. 8)
I may look like a mule, but I'm not a complete ass.
Sebe
Enthusiast
Enthusiast
Posts: 160
Joined: Sun Dec 19, 2004 10:55 pm
Location: Munich
Contact:

Post by Sebe »

Your my personal hero of the month :D
All we need now are easy to use and good documented cipher functions for AES, Twofish, etc.
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Post by JCV »

Updated:
-Now supports FileFingerprint
-Code cleanup

Supported FileFingerprint Functions:
Debug PureHash_WhirlpoolFileFingerprint("c:\data.rar")
Debug PureHash_RIPEMD160FileFingerprint("c:\data.rar")
Debug PureHash_MD2FileFingerprint("c:\data.rar")
Debug PureHash_MD4FileFingerprint("c:\data.rar")
Debug PureHash_MD5FileFingerprint("c:\data.rar")
Debug MD5FileFingerprint("c:\data.rar")
; Debug PureHash_HAVAL256FileFingerprint("c:\data.rar"); NOT YET WORKING
Debug PureHash_GOSTFileFingerprint("c:\data.rar")
Debug PureHash_SHAFileFingerprint("c:\data.rar")
Debug PureHash_SHA1FileFingerprint("c:\data.rar")
Debug PureHash_SHA224FileFingerprint("c:\data.rar")
Debug PureHash_SHA256FileFingerprint("c:\data.rar")
Debug PureHash_SHA384FileFingerprint("c:\data.rar")
Debug PureHash_SHA512FileFingerprint("c:\data.rar")
Not currently supported:
PureHash_HAVAL256FileFingerprint - I'm getting some invalid memory headaches. :?

I compared built-in MD5 in PB and PureHash_MD5 is 3X faster. :)

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

Really really nice.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

@JCV

Can you make this lib support threadsafe? When I use it and enable the threadsafe flad in the compiler options, I get 'Unresolved external symbol _PB_StringBasePosition'.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

JCV wrote:I compared built-in MD5 in PB and PureHash_MD5 is 3X faster. :)
Wow, pretty good!
I like logic, hence I dislike humans but love computers.
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Post by JCV »

Updated:
Added
-ThreadSafe PureLib
-Unicode PureLib
-Unicode ThreadSafe PureLib

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Super! Thank you for the fast update :D.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
michaeled314
Enthusiast
Enthusiast
Posts: 340
Joined: Tue Apr 24, 2007 11:14 pm

Post by michaeled314 »

Why don't you release a help file too
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Post by JCV »

michaeled314 wrote:Why don't you release a help file too
Do I really need to make? What only differs in built-in pb function is the algorithm used. (NAMEFileFingerprint and NAMEFingerprint) :?

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
User avatar
Jacobus
User
User
Posts: 88
Joined: Wed Nov 16, 2005 7:51 pm
Location: France
Contact:

Post by Jacobus »

JCV wrote:
michaeled314 wrote:Why don't you release a help file too
Do I really need to make?
yes, or else, your great lib will be use only by the best programers. Isn't it a shame?. Would you make this help, for all cryptographic functions of your lib 8) please.

Thanks
PureBasicien tu es, PureBasicien tu resteras.
PBUser
User
User
Posts: 20
Joined: Mon Aug 20, 2007 6:03 pm
Location: Germany

Post by PBUser »

Hi,

the Lib is great, but if i enable ThreadSafe, i get this error message:

Image

is that a bug in the library? i have copied all the files in the right directory. (The Lib in PureLibraries\UserLibraries and the SubSystem Files in Subsystem\[Directory])

i have to use TheadSafe, otherwise i get an IMA in my program. when i saw, that it does'nt work with PB4.10beta, i tried PB4.02, but there was the same error.

Can u help me please?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

PBUser wrote:Hi,
the Lib is great, but if i enable ThreadSafe, i get this error message: ...
Did you enable the 'UserLibThreadSafe' subsystem in the IDE ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply