From adbdc15a2d619fe879d7a4f11b13e7826befaada Mon Sep 17 00:00:00 2001 From: David Ashby Date: Sun, 3 Sep 2017 22:21:46 -0400 Subject: [PATCH] update readme with SHA1 --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e34f8a..f25f097 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,31 @@ # SHAmwow -Sometimes you just want to understand how an algorithm works, so you implement it yourself. +Sometimes you just want to understand how your hashing algorithms works, so you implement them yourself. -The sha2 function in shamwow.rb implements the SHA-256 hashing function in Ruby. shamwow_test.rb contains a few sanity tests for the right-rotate function and for SHA2 itself, testing against the output of the `Digest::SHA2.hexdigest` method in the Ruby standard library. +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! -It should go without saying that this was just for fun, and you should never, ever roll-your-own cryptography primatives for any reasonable purpose! +## sha1 -This was fun. +The sha1 function in `shamwow.rb` implements the SHA1 hashing function in Ruby, outputting the 160-bit hash as a hexadecimal string. -## Sources +### sources + +* wikipedia's pseudocode breakdown: + +## sha2 + +The sha2 function in `shamwow.rb` implements the SHA-256 hashing function in Ruby, outputting the 256-bit hash as a hexadecimal string. + +### Sources * the actual spec: * wikipedia's pseudocode breakdown: * a JS implementation that helped as I was debugging some boneheaded mistakes: +## Tests + +`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. + ## Obligatory [![ShamWOW](https://img.youtube.com/vi/F3lrhPeK6gU/0.jpg)](https://www.youtube.com/watch?v=F3lrhPeK6gU)