PJW hash function
PJW hash function is a non-cryptographic hash function created by Peter J.[4] Weinberger of AT&T Bell Labs.[src]
PJW hash function is a non-cryptographic hash function created by Peter J.[4] Weinberger of AT&T Bell Labs.[src] ==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.[4] 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.[src] ==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.[4] When long is wider than 32 bits, as it is on many 64-bit systems, the code contains a bug.[src] ==References==[src]
9 sentences · 9 cited inline · 4 references stored
References
- Hashing Rehashed · retrieved 2026-11-19 · rev 1253333688
Cite this reference
MLA "Hashing Rehashed." Binstock, Andrew (1996). 2026-11-19. http://www.drdobbs.com/database/hashing-rehashed/184409859. Accessed 26 November 2026.
Chicago "Hashing Rehashed." Binstock, Andrew (1996). 2026-11-19. http://www.drdobbs.com/database/hashing-rehashed/184409859.
APA Binstock, Andrew (1996). (2026). Hashing Rehashed. Retrieved November 26, 2026, from http://www.drdobbs.com/database/hashing-rehashed/184409859
- Hash Functions · retrieved 2015-06-09 · rev 1253333688
Cite this reference
MLA "Hash Functions." 2015-06-09. http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200101/homework10/hashfuncs.html. Accessed 26 November 2026.
Chicago "Hash Functions." 2015-06-09. http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200101/homework10/hashfuncs.html.
APA encyclopegia.org. (2015). Hash Functions. Retrieved November 26, 2026, from http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200101/homework10/hashfuncs.html
- CORPORATE UNIX Press (1993). System V application binary interface . ISBN 0-13-100439-5 . Wikipedia revision 1253333688, retrieved 2026-11-20 · retrieved 2026-11-19 · rev 1253333688
Cite this reference
MLA "CORPORATE UNIX Press (1993). System V application binary interface . ISBN 0-13-100439-5 . Wikipedia revision 1253333688, retrieved 2026-11-20." CORPORATE UNIX Press (1993). 2026-11-19. https://archive.org/details/systemvapplicati00unix. Accessed 26 November 2026.
Chicago "CORPORATE UNIX Press (1993). System V application binary interface . ISBN 0-13-100439-5 . Wikipedia revision 1253333688, retrieved 2026-11-20." CORPORATE UNIX Press (1993). 2026-11-19. https://archive.org/details/systemvapplicati00unix.
APA CORPORATE UNIX Press (1993). (2026). CORPORATE UNIX Press (1993). System V application binary interface . ISBN 0-13-100439-5 . Wikipedia revision 1253333688, retrieved 2026-11-20. Retrieved November 26, 2026, from https://archive.org/details/systemvapplicati00unix
- ELF hash function may overflow · retrieved 2023-04-13 · rev 1253333688
Cite this reference
MLA "ELF hash function may overflow." 2023-04-13. https://maskray.me/blog/2023-04-12-elf-hash-function. Accessed 26 November 2026.
Chicago "ELF hash function may overflow." 2023-04-13. https://maskray.me/blog/2023-04-12-elf-hash-function.
APA encyclopegia.org. (2023). ELF hash function may overflow. Retrieved November 26, 2026, from https://maskray.me/blog/2023-04-12-elf-hash-function
Cite this article
MLA
"PJW hash function." encyclopegia.org, 2024, https://encyclopegia.org/wiki/pjw-hash-function. Accessed 26 November 2026.
Chicago
"PJW hash function." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/pjw-hash-function.
APA
encyclopegia.org. (2024). PJW hash function. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/pjw-hash-function
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON