MD5 BSD like passwords

F

Felipe Cruxen

I'm coding a "postfixadmin" using ruby, so, all the passwords are stored
in DB using a bsd like md5 hash. Is there any simple way I could
generate passwords like that (the same hash could be used to generate
shadow pass?)?.

Really sorry for my lame english, and if the question is stupid, but I'm
a real newbie to ruby.

Thanks in advance.
 
J

Jan Svitok

I'm coding a "postfixadmin" using ruby, so, all the passwords are stored
in DB using a bsd like md5 hash. Is there any simple way I could
generate passwords like that (the same hash could be used to generate
shadow pass?)?.

Really sorry for my lame english, and if the question is stupid, but I'm
a real newbie to ruby.

you can generate MD5 with:
require 'digest/md5'
hash = Digest::MD5.digest(data) # binary
or hash = Digest::MD5.hexdigest(data) #hexa
 
F

F. Senault

Le 13 janvier 2007 à 14:41, Felipe Cruxen a écrit :
I'm coding a "postfixadmin" using ruby, so, all the passwords are stored
in DB using a bsd like md5 hash. Is there any simple way I could
generate passwords like that (the same hash could be used to generate
shadow pass?)?.

If that's really a BSD-like password (in the form $n$aaaaaaa$aa...), the
crypt function should be able to generate it on a unix system, as long
as you pass the entire salt ($ included) :
=> "$1$Eou1PtvJ$bh2HAitLkEOwoU6Fjuh8i0"

If you take a look at the manpage of the crypt system function (man 3
crypt or http://www.freebsd.org/cgi/man.cgi?query=crypt&sektion=3 ),
you'll see an explanation of the hash format.

I have no idea of the portability of that function, though. For
instance, it doesn't work on my Windows box, but it works well enough
with FreeBSD and Linux.

Fred
 
F

Felipe Cruxen

Felipe said:
I'm coding a "postfixadmin" using ruby, so, all the passwords are stored
in DB using a bsd like md5 hash. Is there any simple way I could
generate passwords like that (the same hash could be used to generate
shadow pass?)?.

Really sorry for my lame english, and if the question is stupid, but I'm
a real newbie to ruby.

Thanks in advance.

just found out facets library, sorry for the stupid question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top