Skip to content

Instantly share code, notes, and snippets.

/pow_gino.rb Secret

Created December 2, 2017 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a0470688b3d78344164de31123312979 to your computer and use it in GitHub Desktop.
Save anonymous/a0470688b3d78344164de31123312979 to your computer and use it in GitHub Desktop.
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