-
-
Save Ninjex/9048279 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output for hash will not have trailing whitespace, so there is no need for
.chomp!
Use string interpolation not the
+
method. Also, there is no need for\n
sinceputs
does this by default.