Roxen.git/
server/
modules/
security/
auth_httpcookie.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2015-01-15
2015-01-15 15:36:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>
7325fcf5f7a880e32df325ecaa3125d3fc42e063 (
5
lines) (+
3
/-
2
)
[
Show
|
Annotate
]
Branch:
319a5937257d5dfe1080c4221b043d01ecd3eb52
auth_httpcookie: Use SHA1 to generate the cookie.
64:
protected string create_cookie( string u, string p ) {
-
int
i
=
(((hash(u)
<<
32)
|
hash(
p))
<<
32)
|
hash(u+p);
-
string
c
= i->digits(16
);
+
string
c
=
+
String.string2hex(Crypto.SHA1.
hash(
COOKIE
+
u
+
"\0"
+
p
+
COOKIE
);
catch(get_my_sql()->query( "INSERT INTO "+table+" " "(cookie,name,password) VALUES " "(%s,%s,%s)", c, encode_pw(u), encode_pw(p) ));