-
-
Save codenoid/5f59ddfc1f9326c3ce8ced4acc8e654c to your computer and use it in GitHub Desktop.
Check your passwords against https://haveibeenpwned.com/Passwords
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
# Check your passwords against https://haveibeenpwned.com/Passwords | |
# Usage: | |
# crystal run --release check_passwords.cr -- pwned-passwords*.txt | |
# Enter your passwords one per line, then press Return twice | |
require "digest/sha1" | |
my_passwords = Hash(String, String).new | |
until (line = gets || "").empty? | |
my_passwords[Digest::SHA1.hexdigest(line).upcase] = line | |
end | |
ARGV.each do |filename| | |
puts "----#{filename}----" | |
File.each_line(filename) do |line| | |
if my_passwords.has_key? line | |
puts my_passwords[line] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment