Not the entire code, just the important lines
$domain = yp_get_default_domain();
if ($pw_entry = yp_match ($domain, "passwd.byname", $input_user)) {
(found a user in NIS)
}
$values = explode(":",$pw_entry);
$stored_password = trim($values[1]);
$salt = substr($stored_password, 0, 2);
$crypted_password = crypt($input_pw,$salt);
if (!strcmp($stored_password, $crypted_password)) {
(password match)
}
(and this window is too narrow to type code!)