Skip to content

Instantly share code, notes, and snippets.

@46bit
Created January 18, 2013 18:36
Show Gist options
  • Save 46bit/4567048 to your computer and use it in GitHub Desktop.
Save 46bit/4567048 to your computer and use it in GitHub Desktop.
Generate some SecureRandom data with a simple command. Handy when you don't want to run off to a CLI or dive into messy libs.
#!/usr/bin/env ruby
require "securerandom"
length = 24
if ARGV[0]
length = ARGV[0].to_i
end
puts SecureRandom.base64(length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment