Skip to content

Instantly share code, notes, and snippets.

@dstrelau
Created October 22, 2009 22:53
Show Gist options
  • Select an option

  • Save dstrelau/216425 to your computer and use it in GitHub Desktop.

Select an option

Save dstrelau/216425 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment