|David Ashby 0dde966e66||5 years ago|
|README.md||5 years ago|
|shamwow.rb||6 years ago|
|shamwow_test.rb||6 years ago|
|slides-with-notes.pdf||6 years ago|
|slides.key||6 years ago|
|slides.pdf||6 years ago|
Sometimes you just want to understand how your hashing algorithms work, so you implement them yourself.
It should go without saying that this was just for fun, and you should never, ever, ever roll your own cryptography primatives for any purpose other than education!
I gave a talk on this project at Papers We Love NYC! The PDF, Keynote file, and PDF-with-nodes of the slides are also in this repo.
The sha1 function in
shamwow.rb implements the SHA1 hashing function in Ruby, outputting the 160-bit hash as a hexadecimal string.
- wikipedia's pseudocode breakdown: https://en.wikipedia.org/wiki/SHA-1#Examples_and_pseudocode
The sha2 function in
shamwow.rb implements the SHA-256 hashing function in Ruby, outputting the 256-bit hash as a hexadecimal string.
- the actual spec: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
- wikipedia's pseudocode breakdown: https://en.wikipedia.org/wiki/SHA-2#Pseudocode
- a JS implementation that helped as I was debugging some boneheaded mistakes: http://www.movable-type.co.uk/scripts/sha256.html
shamwow_test.rb contains a few sanity tests for the bit-rotation functions and for the hashes themselves, testing against the output of the
Digest gem in the standard library.