1
0
mirror of https://github.com/janet-lang/janet synced 2026-04-25 00:01:26 +00:00

Use siphash for string hashing.

The hash key still needs to randomly initialized
for the security advantage, but this patch is a
step closer to avoiding hash based DOS.

Further work may including exposing the raw hash
function for use by abstract types who also choose to
implement hash.
This commit is contained in:
Andrew Chambers
2020-01-17 11:52:29 +13:00
parent 962cd7e5f5
commit ea02b2fde9
2 changed files with 102 additions and 5 deletions

View File

@@ -1303,6 +1303,7 @@ JANET_API JanetBuffer *janet_pretty(JanetBuffer *buffer, int depth, int flags, J
/* Misc */
JANET_API int janet_equals(Janet x, Janet y);
JANET_API void janet_init_hash_key(uint8_t key[16]);
JANET_API int32_t janet_hash(Janet x);
JANET_API int janet_compare(Janet x, Janet y);
JANET_API int janet_cstrcmp(JanetString str, const char *other);