pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2016-11-05
2016-11-05 11:48:26 by Martin Nilsson <nilsson@fastmail.com>
68657284043242b9d8255de33b5ff8cd0fc42a70 (
17
lines) (+
17
/-
0
)
[
Show
|
Annotate
]
Branch:
8.1
Exposed siphash-2-4 as Crypto.siphash24
755:
} }
+
/*! @decl siphash24(string data, void|int key)
+
*! @appears Crypto.siphash24
+
*!
+
*! Hashes a string, with an optional key, to a 64 bit integer using
+
*! the siphash-2-4 algorithm. Currently the 64 bit @[key] parameter
+
*! is used both for the high and low part of the 128 bit key.
+
*!
+
*/
+
#include "siphash24.h"
+
PIKEFUN int siphash24(string s, void|int key)
+
{
+
mpz_t ret;
+
mpz_init(ret);
+
mpz_set_ui(ret, pike_string_siphash24(s, key && key->u.integer) );
+
push_bignum(ret);
+
}
/*! @decl string int2char(int x) *! @appears String.int2char