Skip to content

Instantly share code, notes, and snippets.

@macghriogair
Created March 3, 2016 13:21
Show Gist options
  • Save macghriogair/e1850d207404c1655c61 to your computer and use it in GitHub Desktop.
Save macghriogair/e1850d207404c1655c61 to your computer and use it in GitHub Desktop.
Create hash for a htpasswd auth file
#!/usr/bin/env ruby
unless ARGV.length == 2
puts "Dude, not the right number of arguments."
puts "Usage: ruby htpassword.rb username 'password'\n"
exit
end
username = ARGV[0]
passwd = ARGV[1]
hash = %Q{#{passwd}}.crypt(%Q{salt})
puts "#{username}:#{hash}"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment