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

Re: crypt() on OpenBSD



Hello!

On Tue, Jul 27, 1999 at 02:02:38AM -0700, azazel@123india.com wrote:
> [...]

> So, what do I actually put into $salt ?

To check a password, just give the *whole* encrypted password as salt.
That is supposed to work for every encryption method.

i.e. in C:
if (strcmp(crypt(what_the_user_has_input_as_password, crypted_pw), crypted_pw))
	wrong
else
	right

In perl:
if (crypt($user_input, $crypted_pw) ne $crypted_pw) {
	wrong;
} else {
	right;
}

I don't really understand why adduser uses an external binary for that
purpose, as perl is linked against the OpenBSD libc whose crypt()
function performs all non-traditional encryption methods very fine.

> [...]

Regards, Hannah.