Skip to content

Instantly share code, notes, and snippets.

@durana
Created January 14, 2010 22:23
Show Gist options
  • Save durana/277577 to your computer and use it in GitHub Desktop.
Save durana/277577 to your computer and use it in GitHub Desktop.
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