Hashing algorithms

If the result of a process is always the same length irrespective of the amount of data provided, you may be facing a hashing function. To determine which function, you can use the length of the resulting value:

Function Length Example, hash ("Web Penetration Testing with Kali Linux")
MD5 16 bytes fbdcd5041c96ddbd82224270b57f11fc
SHA-1 20 bytes e8dd62289bcff206905cf269c06692ef7c6938a0
SHA-2 (256) 32 bytes dbb5195ef411019954650b6805bf66efc5fa5fef4f80a5f4afda702154ee07d3
SHA-2 (512) 64 bytes

6f0b5c34cbd9d66132b7d3a4484f1a9af02965904de38e3e3c4e66676d9

48f20bd0b5b3ebcac9fdbd2f89b76cfde5b0a0ad9c06bccbc662be420b877c080e8fe

 

Notice how the preceding examples represent each byte in a hexadecimal codification using two hexadecimal digits to represent the value of each byte (0-255). For clarification, the 16 bytes in the MD5 hash are fb-dc-d5-04-1c-96-dd-bd-82-22-42-70-b5-7f-11-fc. The eleventh byte (42), for example, is the decimal value 66, which is the ASCII letter B.

Also, it is not uncommon to find hashes in base64 encoding. For example, the SHA-512 hash in the preceding table could also be presented as follows:

bwtcNMvZ1mEyt9OkSE8amvApZZBN444+PE5mZ22UjyC9C1s+vKyf29L4m3bP3lsKCtnAa8y8ZivkILh3wIDo/g== 
Base64 is an encoding technique used to represent binary data using only the set of printable ASCII characters, where a base64-encoded byte represents 6 bits from the original byte so that 3 bytes (24 bits) can be represented in base64 with 4 ASCII printable bytes.