Skip to content

Instantly share code, notes, and snippets.

@reprah
reprah / SHA1.rb
Last active January 16, 2022 06:10 — forked from tstevens/SHA1.rb
#!/usr/bin/ruby
require 'rubygems'
require 'active_support/all'
require 'digest/sha1'
def leftrotate(value, shift)
return ( ((value << shift) | (value >> (32 - shift))) & 0xffffffff)
end
# FIPS 180-2 -- relevant section #'s below