Created
January 14, 2010 22:23
-
-
Save durana/277577 to your computer and use it in GitHub Desktop.
This file contains 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 'sha1' | |
module LegibleHash | |
CHARS = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a - ['0', 'O', '1', 'I', 'l'] | |
def self.digest (str) | |
SHA1.digest(str).each_byte.map { |byte| CHARS[byte.modulo(CHARS.length)] }.join | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment