[*] Replace Jenkins with FNV1a

They refuse to acknowledge what this algorithm is - its JOAAT

People have known its susceptible to collisions more than other algorithms since the fucking 90s: https://nextcloud.reece.sx/index.php/s/9FcaLSSF7C6CWkF/preview

Brainlets have been DoSing node servers with it since the early 2010s: https://fahrplan.events.ccc.de/congress/2011/Fahrplan/events/4680.en.html

Their fix was to include a random seed, which as stated in the 90s thing, doesn't fucking help. Linux devs figured that out in the mid 2000s: 81a0271004

And in 2017 they're still talking about how fucking smart they are in their blog larp posts: https://v8.dev/blog/hash-flooding
...yet they still wont fucking use a sane hashing algorithm that doesnt collide all the god damn time

Last aurora commit: 1f6ee19e

(btw: there's a bunch of invalid iterator access and braindead ways you can stall v8 threads. this is the quality of ivan code we're dealing with. no wonder rust-tards point to v8 cves to """prove""" their language is worth of a fuck. actually, i take that back, ivan might be confused by templates, but even eastern bloc developers aren't as retarded as the mostly eu devs google employs to work on this fucking shit)
This commit is contained in:
Reece Wilson 2023-05-19 05:14:19 +01:00
parent 1f6ee19ed3
commit 9480aab0d3

View File

@ -26,9 +26,9 @@ uint32_t StringHasher::AddCharacterCore(uint32_t running_hash, uint16_t c) {
} }
uint32_t StringHasher::GetHashCore(uint32_t running_hash) { uint32_t StringHasher::GetHashCore(uint32_t running_hash) {
running_hash += (running_hash << 3); //running_hash += (running_hash << 3);
running_hash ^= (running_hash >> 11); //running_hash ^= (running_hash >> 11);
running_hash += (running_hash << 15); //running_hash += (running_hash << 15);
int32_t hash = static_cast<int32_t>(running_hash & String::HashBits::kMax); int32_t hash = static_cast<int32_t>(running_hash & String::HashBits::kMax);
// Ensure that the hash is kZeroHash, if the computed value is 0. // Ensure that the hash is kZeroHash, if the computed value is 0.
int32_t mask = (hash - 1) >> 31; int32_t mask = (hash - 1) >> 31;
@ -80,7 +80,8 @@ uint32_t StringHasher::HashSequentialString(const char_t* chars_raw, int length,
// Perform a regular hash computation, and additionally check // Perform a regular hash computation, and additionally check
// if there are non-digit characters. // if there are non-digit characters.
String::HashFieldType type = String::HashFieldType::kIntegerIndex; String::HashFieldType type = String::HashFieldType::kIntegerIndex;
uint32_t running_hash = static_cast<uint32_t>(seed);
uint32_t running_hash = 0x811c9dc5u;
uint64_t index_big = 0; uint64_t index_big = 0;
const uchar* end = &chars[length]; const uchar* end = &chars[length];
while (chars != end) { while (chars != end) {
@ -88,10 +89,14 @@ uint32_t StringHasher::HashSequentialString(const char_t* chars_raw, int length,
!TryAddIntegerIndexChar(&index_big, *chars)) { !TryAddIntegerIndexChar(&index_big, *chars)) {
type = String::HashFieldType::kHash; type = String::HashFieldType::kHash;
} }
running_hash = AddCharacterCore(running_hash, *chars++);
uint16_t a = uint16_t(*chars++); // Latin1 -> UTF16; or UTF16 -> UTF16
running_hash ^= uint32_t(a & 0xFF) * 0x01000193u;
running_hash ^= uint32_t((a >> 8) & 0xFF) * 0x01000193u;
} }
uint32_t hash = uint32_t hash =
String::CreateHashFieldValue(GetHashCore(running_hash), type); String::CreateHashFieldValue(GetHashCore(running_hash), type);
if (Name::ContainsCachedArrayIndex(hash)) { if (Name::ContainsCachedArrayIndex(hash)) {
// The hash accidentally looks like a cached index. Fix that by // The hash accidentally looks like a cached index. Fix that by
// setting a bit that looks like a longer-than-cacheable string // setting a bit that looks like a longer-than-cacheable string
@ -112,10 +117,12 @@ uint32_t StringHasher::HashSequentialString(const char_t* chars_raw, int length,
} }
// Non-index hash. // Non-index hash.
uint32_t running_hash = static_cast<uint32_t>(seed); uint32_t running_hash = 0x811c9dc5u;
const uchar* end = &chars[length]; const uchar* end = &chars[length];
while (chars != end) { while (chars != end) {
running_hash = AddCharacterCore(running_hash, *chars++); uint16_t a = uint16_t(*chars++); // Latin1 -> UTF16; or UTF16 -> UTF16
running_hash ^= uint32_t(a & 0xFF) * 0x01000193u;
running_hash ^= uint32_t((a >> 8) & 0xFF) * 0x01000193u;
} }
return String::CreateHashFieldValue(GetHashCore(running_hash), return String::CreateHashFieldValue(GetHashCore(running_hash),