Girish Mahajan (Editor)

PJW hash function

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

PJW hash function is a non-cryptographic hash function created by Peter J. Weinberger of AT&T Bell Labs.

Contents

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 previous hash and adding current byte followed by moving high bits:

Implementation

Below is the algorithm implementation used in UNIX ELF format:

References

PJW hash function Wikipedia