Skip to content

Instantly share code, notes, and snippets.

@shanesveller
Created December 5, 2008 20:37
Show Gist options
  • Save shanesveller/32502 to your computer and use it in GitHub Desktop.
Save shanesveller/32502 to your computer and use it in GitHub Desktop.
Generates a 32-length random key of /[0-9A-F]/ characters
Array.new(16) { rand(256) }.pack('C*').unpack('H*').first
# => b3512f4972d314da94380e1a70e6814a
# Courtesy of http://norbauer.com/notes/generating-access-keys
# via rubyjudo.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment