Skip to content

Instantly share code, notes, and snippets.

@Ninjex
Ninjex / gist:9048279
Last active August 29, 2015 13:56 — forked from Amazingred/gist:4104717
#!/usr/bin/env ruby
# Ruby script to generate SSHA (Good for LDAP)
require 'digest/sha1'
require 'base64'
# The output in hash will never have trailing whitespace, removed .chomp!
hash = Base64.encode64(Digest::SHA1.digest(#{pass}#{salt}#{salt}))
# Use string interpolation, no need to add \n puts does this for you
puts "userPassword: #{hash}"