tags:

views:

48

answers:

3

I want to learn how to do a hash by hand (like with paper and pencil). Is this feasible? Any pointers on where to learn about this would be appreciated.

A: 

You can start by looking at

Hash function

astander
+1 to compensate for the unexplained downvote. I looked at the page you linked, and it **does** provide some good examples of hash functions that could easily be calculated by hand (in the *Hash function algorithms* section).
David
+1  A: 

I would suggest trying a CRC, since it seems to me to be the easiest to do by hand: http://en.wikipedia.org/wiki/CRC32#Computation_of_CRC .

You can do a smaller length than standard (it's usually 32 bit) to make things easier.

zebediah49
+1  A: 

That depends on the hash you want to do. You can do a really simple hash by hand pretty easily -- for example, one trivial one is to take the ASCII values of the string, and add them together, typically doing something like a left-rotate between characters. So, to hash the string "Hash", we'd start with the ASCII values of the letters (in hex): 48 61 73 68. We'll add those together, rotating our result left 4 bits (in a 16-bit word) between letters:

0048 + 0061 = 00A9
00A9 <<< 4 = 0A90
0A90 + 0073 = 0B03
B03 <<< 4 = B030
B030 + 68 = B098

Result: B098

Doing a cryptographic hash by hand would be a rather different story. It's certainly still possible, but would be extremely tedious, to put it mildly. A cryptographic hash is typically quite a bit more complex, and (more importantly) almost always has a lot of "rounds", meaning that you basically repeat a set of steps a number of times to get from the input to the output. Speaking from experience, just stepping through SHA-1 in a debugger to be sure you've implemented it correctly is a pain -- doing it all by hand would be pretty awful (but as I said, certainly possible anyway).

Jerry Coffin