Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21e7bdfca488305

Jump to content

Talk:PJW hash function

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 1 month ago by NormanGray in topic Buggy Implementation

Properties of this hash method

[edit]

Some properties of the hash is expected. Jackzhp (talk) 19:44, 20 September 2017 (UTC)Reply

It's a *very bad* hash function. For a list of 466K English words, it generates 4347 collisions. Much worse than FNV-1a (23 collisions) or Jenkin's OAAT (36 collisions) or even DJB2 (344 collisions). And I'm not sure whether it is notable at all. I can't find it in modern ELF specifications. --Amakuha (talk) 05:27, 3 November 2021 (UTC)Reply
Looking at musl libc, I see it is still checked. According to this, most OSes have indeed moved to the GNU hash, however notably, it still seems to be used in version this - I am not sure whether this is checked though. 203.94.59.88 (talk) 02:58, 31 July 2025 (UTC)Reply

Buggy Implementation

[edit]

Having a known buggy implementation example and pointing it out seems a bit strange. Why not use a better one, such as the one from musl libc? Or even patch the existing one and make a note of it? 203.94.59.88 (talk) 06:50, 4 August 2025 (UTC)Reply

Also, the implementation is inconsistent with the algorithm just above it. Based on the indentation in the latter, the operation h := h & ~high is included only if high is non-zero, but in the implementation, it's included in all cases. This doesn't matter in practice since, if high==0, then ~high is 0xffffffff, and the implementation's h &= ~high line is a no-op, but it should still be skipped. NormanGray (talk) 13:43, 31 May 2026 (UTC)Reply