[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Tool to crypt a password



Hi.

Does anybody know a packaged program that provides a simple but good
interface to the libc's crypt() function?

I mean something that reads "2JTnJhXPzISn" on stdin and writes
"$6$BqdmYkw0fsG5y8Av$LOTAkcnFu.LJlaZH./16RgX.IqSPoxuhALCqgih9tMqspMLMVzJ9WZqxUJr/.ium/8pi3iWh56G..V1XcRvNo."
on stdout, no more.

The closest thing I found for now is htpasswd, from apache2-utils. It
has the drawback of always wanting to work with a file, but a temp file
is not a big bother. More problematically, it only knows the oldest and
weakest hashing algorithms.

A good tool needs command-line options to choose between any hashing
algorithm supported by the libc and select the various options,
including the number of rounds. Ideally, it would parse /etc/login.defs
to use the same defaults as what passwd would put in /etc/shadow.

Is is quite easy to implement, as all the tricky crypto is already in
the libc and it would not run in an hostile environment. A few lines of
perl do the trick. But it is better to be able to rely on something
packaged.

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: Digital signature


Reply to: