Created
February 10, 2018 16:49
-
-
Save nnkken/0cf3e1472f417f262464d11fa46a242e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "openssl" | |
def enumerate(n, set, target) | |
set.repeated_permutation(n) do |arr| | |
if OpenSSL::Digest.digest("sha1", OpenSSL::Digest.digest("sha1", arr.join)) == target | |
return arr | |
end | |
end | |
return nil | |
end | |
target = [207, 145, 125, 199, 75, 210, 227, 4, 202, 157, 34, 133, 79, 100, 133, 38, 187, 182, 131, 134].pack("c*") | |
set = ("a".."z").map(&:to_s) | |
p enumerate(5, set, target) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment