pike.git/
src/
post_modules/
Nettle/
nettle.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2012-07-25
2012-07-25 21:03:06 by Martin Nilsson <nilsson@opera.com>
395c4afebc4c834ee3d7fc1356f8928a65c35761 (
17
lines) (+
14
/-
3
)
[
Show
|
Annotate
]
Branch:
7.9
Added option to modify magic on crypt_md5 call.
274:
/*! @endclass */
-
/*! @decl string crypt_md5(string password, string salt)
+
/*! @decl string crypt_md5(string password, string salt
, void|string magic
)
*! Does the crypt_md5 abrakadabra (MD5 + snakeoil). *! It is assumed that @[salt] does not contain "$". */
-
PIKEFUN string crypt_md5(string pw, string salt)
+
PIKEFUN string crypt_md5(string pw, string salt
, void|string magic
)
optflags OPT_TRY_OPTIMIZE; { char *hash; NO_WIDE_STRING(pw); NO_WIDE_STRING(salt);
-
hash = pike_crypt_md5(pw->len, pw->str, salt->len, salt->str);
+
if(!magic)
+
{
+
hash = pike_crypt_md5(pw->len, pw->str, salt->len, salt->str
,
+
3, "$1$"
);
+
}
+
else
+
{
+
hash = pike_crypt_md5(pw->len, pw->str, salt->len, salt->str,
+
magic->len, magic->str);
+
}
+
push_text(hash); }