Determine Hash Value Algorithm

Sayth

Gawd
Joined
Oct 7, 2001
Messages
618
If I have a hash value, is there any way to determine if it is SHA1, MD5, etc...?

Thanks
 
SHA1 and MD5 are different lengths, also character sets of the output can differ between algorithms.
 
Unfortunately my SHA1 should be in Base16 just like MD5. So the length is the same.... :confused:
 
So I have

Code:
hash 1:
15PF40F1240Z91E3CDE26E9314456F1BBAA639BE

hash 2:
CW7UB4JEBSI6HWPCN2JBIRLPDO5NMON6

Hash 3:
F4CD450FBAB62FFBBCC249374BA17F5A

I know that "hash 1" is SHA1 and I believe Base 32 with 40 chars.

I know that "hash 3" is MD5 and it's in Base16 Hex.

I assume "hash 2" is SHA1 Base16 because it has the same number of characters (32) however for some reason it doesn't follow the A-F 0-9 scheme that I am used to.

Does that only apply to specifically "Base 16 Hex" ? Or any "Base 16" representation.

If this is not making sense I apologize. My head is spinning right now.
 
Okay now I think I got that wrong.

hash 1 = 40 Char SHA1 - Base16 because only a-f 0-9

hash 2 = 32 Char SHA1 - Base32 because there are more than a-f 0-9

hash 3 = 32 Char MD5 - Base16 because only a-f 0-9


These are the only possibilities in my small collection so do you think it's safe to assume that:

Any 32 char hash with only a-f 0-9 is base16 MD5

Any 32 char hash outside the a-f 0-9 scope is base32 SHA1

Any 40 char hash is base16 SHA1

Okay I think I've got it sorted now. It helps me to think online like this.
 
You realize the hash is just an x-bit number right? Any hash of a certain length can be represented the same way. If the hash is properly designed, it should be indistinguishable from random data, and thus any two hash algorithms' output should be indistinguishable from each other if they have the same length (or are padded).

But if you know the possible hash algorithms and output lengths that are possible in the system you're analyzing, you can probably make reasonable assumptions as you have done. MD5 is 128-bit, SHA-1 is 160 bit. A hex digit encodes 4 bits, so a 40-bit hex number represents 160 bits.
 
Brilliant my friend. The bit length. Okay so that makes more sense now. It's amazing how these things leave you once you stop studying/working with them. Been out of college now for 3 years. Daily grind routine turns my brain to mush!

My work wants me to go get one of them A+ certs now so I guess I should read up on my bit counting and Hex math. Just a matter of refreshing I think.

Appreciate your help. Cheers
 
Back
Top