{
  "id": "enwiki-001253333688",
  "slug": "pjw-hash-function",
  "title": "PJW hash function",
  "qid": "",
  "lead": "PJW hash function is a non-cryptographic hash function created by Peter J. Weinberger of AT&T Bell Labs.",
  "body": "PJW hash function is a non-cryptographic hash function created by Peter J. Weinberger of AT&T Bell Labs. ==Other versions== A variant of PJW hash had been used to create ElfHash or Elf64 hash that is used in Unix object files with ELF format. Allen Holub has created a portable version of PJW hash algorithm that had a bug and ended up in several textbooks, as the author of one of these textbooks later admitted. ==Algorithm== PJW hash algorithm involves shifting the previous hash and adding the current byte followed by moving the high bits: algorithm PJW_hash(s) is uint h := 0 bits := uint size in bits for i := 1 to |S| do h := h > bits * 3/4) h := h & ~high return h ==Implementation== Below is the algorithm implementation used in Unix ELF format: unsigned long ElfHash(const unsigned char *s) { unsigned long h = 0, high; while (*s) { h = (h > 24; h &= ~high; } return h; } This C code incorrectly assumes that long is a 32-bit data type. When long is wider than 32 bits, as it is on many 64-bit systems, the code contains a bug. ==References==",
  "categories": [
    "23302980",
    "23603337",
    "23837581",
    "26220375",
    "95740265"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1253333688",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1729853240.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001253333688",
    "type": "webpage",
    "title": "PJW hash function",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/pjw-hash-function",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          20
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          20
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001253333688",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1253333688",
    "note": "Immutable snapshot enwiki-001253333688"
  }
}