Cryptographic Hash Functions Collection (IncludeFile)

Developed or developing a new product in PureBasic? Tell the world about it.
PBUser
User
User
Posts: 20
Joined: Mon Aug 20, 2007 6:03 pm
Location: Germany

Post by PBUser »

Thanks! It worked, but now the built-in MD5Fingerprint Function is 2 times faster than PureHash_MD5Fingerprint. What's the reason for that?

//edit: That's my configuration:

Image
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post by localmotion34 »

Hey JCV...

with PB 4.20 beta, the below example spits out:

Code: Select all

string_sample.s = "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))

Code: Select all

38383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838
3838383838383838383838383838383838383838
38383838383838383838383838383838
38383838383838383838383838383838
38383838383838383838383838383838
3838383838383838383838383838383838383838383838383838383838383838
3838383838383838383838383838383838383838383838383838383838383838
3838383838383838383838383838383838383838
3838383838383838383838383838383838383838
38383838383838383838383838383838383838383838383838383838
3838383838383838383838383838383838383838383838383838383838383838
383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838
38383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838
The hash functions, and the file functions give me weitd results. any idea how ti fix this?

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

Does PeekC/PokeC work correctly on your compiler? Mine show different result.
I think thats the problem. :?

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post by localmotion34 »

no the PeekC functions DO NOT work at all. I wonder what is going on here?

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

I updated the package for PB v.4.3x.
Instead of uploading a PureLib, I uploaded an IncludeFile.

See my first post.

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post by localmotion34 »

The link in the first post is still to the compiled LIB.

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

reuploaded.

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
shredder
New User
New User
Posts: 2
Joined: Sat Nov 28, 2009 8:03 am

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by shredder »

Hi there, installed your hash library and it worked a treat the test file ran fine, however the results were wrong!
this is what I have.

The quick brown fox jumps over the lazy dog

9e107d9d372bb6826bd81d3542a419d6............................... md5 from hashcalc. (SlavaSoft)
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 sha1

9e107d9d372bb6826bd81d3542a419d6................................md5 from purebasics built in hash.
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 sha1

A2E9C1AF61B72AA579D0688E048DC7D6..............................md5 hash from Hashlab program run.
172A1D472092C99A91C57E14727A981299CB45B1 sha1

wonder if anyone else has had this problem, can it be fixed?
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by JCV »

I tested it in both ascii and unicode and it has the same result with PB.
PB 4.4 B7 Win7

Code: Select all

Global string_sample.s = "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_MD5Fingerprint(@string_sample, Len(string_sample))
Debug 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 SHA1Fingerprint(@string_sample, Len(string_sample))
non-unicode result
9E107D9D372BB6826BD81D3542A419D6
9e107d9d372bb6826bd81d3542a419d6
2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

unicode result
A2E9C1AF61B72AA579D0688E048DC7D6
a2e9c1af61b72aa579d0688e048dc7d6
172A1D472092C99A91C57E14727A981299CB45B1
172a1d472092c99a91c57e14727a981299cb45b1

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
shredder
New User
New User
Posts: 2
Joined: Sat Nov 28, 2009 8:03 am

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by shredder »

Hi There JVC, Well I see you have two types of input, unicode and non-unicode, guess I must have missed a lesson
somewere hihi, ok Ive loaded the program and library as is, so I am getting the unicode result but need the non-unicode
instead, so could you please tell me how you obtained the non-unicode output, I.E what alterations to the program
lines in order to generate this type of output please,

pb 4.31 win xp this end.

I have copied the lines of code you posted, and the only change was one in upper case and one in lower but same output.
Thanks for the quick reply to my first question.

PS. after doing a search on unicode and checking my compiler options I had the unicode box ticked, after unticking this
box it changed the output to the one I want, so looks like I,ve some way to go on the programing side of things.
thanks again.
SebastianJu2
New User
New User
Posts: 2
Joined: Wed Jun 08, 2011 9:37 pm

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by SebastianJu2 »

Hello JVC,

does your IncludeFile still work? The server seems to have problems so i couldnt download it for testing...

Greetings!
Sebastian
marroh
User
User
Posts: 72
Joined: Wed Aug 06, 2008 8:21 am

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by marroh »

Thank you JCV for this nice functions!
PureBASIC v5.41 LTS , Windows v8.1 x64
Forget UNICODE - Keep it BASIC !
funk.munich
User
User
Posts: 11
Joined: Wed Apr 26, 2006 9:27 pm

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by funk.munich »

Hi everybody,

do you know where I can download the sources?

Thx in advance,
Daniel
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by Zach »

Download link is on the first post of the first page.....which appears to be down :x
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Re: Cryptographic Hash Functions Collection (IncludeFile)

Post by JCV »

Zach wrote:Download link is on the first post of the first page.....which appears to be down :x
Sorry about that.. it seems my host had a downtime before. Just download again. Cheers! Happy New Year! :)

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
Post Reply