SHA1-hashing question :-)

Post comments about Shareaza code and discuss with other developers.
Forum rules
Home | Wiki | Rules

SHA1-hashing question :-)

Postby tomtop » 27 Dec 2009 15:29

I'm trying to create an application that must be compatible with shareaza's SHA1 hashing - but it seems like I can't find out how shareaza makes the hash-codes :roll:

An examle:

In my library I put a acsii-file called "foobar.txt". It contains the text "foobar" and has the size of 6 bytes / octets. ShareAza hashes the file to:

RBB5P6JECYQR32PLXFR76THCQESZGKDY

When I perform a SHA1-hash of the file content ("foobar") and encode the SHA1-digest into base32 (RFC-4648 compliant) I get:

77LU7CA5EELCIY5Z57UY7YSM754C7EZF

What am I doing wrong?
tomtop
 
Posts: 11
Joined: 18 Nov 2009 12:17

Re: SHA1-hashing question :-)

Postby ocexyz » 28 Dec 2009 20:40

User avatar
ocexyz
 
Posts: 624
Joined: 15 Jun 2009 13:09

Re: SHA1-hashing question :-)

Postby tomtop » 28 Dec 2009 21:52

tomtop
 
Posts: 11
Joined: 18 Nov 2009 12:17

Re: SHA1-hashing question :-)

Postby raspopov » 30 Dec 2009 04:52

Use HashLib library (and HashTest as example), its part of Shareaza SVN source tree.
User avatar
raspopov
Project Admin
 
Posts: 945
Joined: 13 Jun 2009 12:30

Re: SHA1-hashing question :-)

Postby tomtop » 30 Dec 2009 14:01

tomtop
 
Posts: 11
Joined: 18 Nov 2009 12:17

Re: SHA1-hashing question :-)

Postby cyko_01 » 30 Dec 2009 15:00

does the file contain metadata or id3 tags? shareaza sometimes strips this information before hashing
User avatar
cyko_01
 
Posts: 938
Joined: 13 Jun 2009 15:51

Re: SHA1-hashing question :-)

Postby tomtop » 30 Dec 2009 15:21

tomtop
 
Posts: 11
Joined: 18 Nov 2009 12:17

Re: SHA1-hashing question :-)

Postby cyko_01 » 30 Dec 2009 16:58

sorry, I should have ready the first post better.
User avatar
cyko_01
 
Posts: 938
Joined: 13 Jun 2009 15:51

Re: SHA1-hashing question :-)

Postby kevogod » 31 Dec 2009 02:29

kevogod
 
Posts: 278
Joined: 13 Jun 2009 16:13

Re: SHA1-hashing question :-)

Postby tomtop » 31 Dec 2009 10:02

Problem solved. It was a matter of reversing the bytes in the dwords of the SHA1-digest. Normally they would be aligned as (byte-numbers, most significant to least significant):

4321 4321 4321 4321 4321

They had to be reversed to (byte-numbers, least significant to most significant):

1234 1234 1234 1234 1234

In order to produce the right result :-)
tomtop
 
Posts: 11
Joined: 18 Nov 2009 12:17


Return to Development Discussion

Who is online

Users browsing this forum: No registered users and 1 guest