dstrelau (owner)

Revisions

gist: 216425 Download_button fork
public
Public Clone URL: git://gist.github.com/216425.git
Embed All Files: show embed
shadow-password.rb #
1
2
3
4
5
6
7
POSSIBLE = [('a'..'z'),('A'..'Z'),(0..9),'.','/'].inject([]) {|s,r| s+Array(r)}
 
def shadow(password)
  salt = Array.new(8) { POSSIBLE[ rand(POSSIBLE.size) ] }
  password.crypt("$1$#{salt}")
end