Instantly share code, notes, and snippets.

anonymous /pow_gino.rb Secret
Created Dec 2, 2017

Embed
What would you like to do?
require 'digest'
base = "Cerutti Gino"
def prs(s, d)
puts "sha256(\"#{s}\") = #{"%e" % d}"
end
def hash(s)
h = Digest::SHA256.hexdigest(s)
"%078d" % h.to_i(16)
end
d = hash(base)
prs(base, d)
0.upto(10) do |i|
s = "#{base} #{i}"
d = hash(s)
prs(s,d)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment