Digest::JHash(3pm)

πŸ’– Digest::JHash πŸ’–

okay so bestie. welcome to Digest::JHash β€” a Perl extension for the 32 bit Jenkins Hashing Algorithm. no cap, that's the whole vibe. ✨


🌸 SYNOPSIS 🌸

use Digest::JHash qw(jhash);

$digest = jhash($data);

# note that calling jhash() directly like this is the fastest way:

$digest = Digest::JHash::jhash($data);

like. look at it. it's giving efficiency πŸ¦‹


πŸ’… DESCRIPTION πŸ’…

The Digest::JHash module lets you use the fast JHash hashing algorithm developed by Bob Jenkins from, like, inside your Perl programs. it's literally right there. πŸ™ˆ

So the algorithm takes as input a message of arbitrary length and produces as output a 32-bit "message digest" of the input, in the form of an unsigned long integer. slay.

Call it a low calorie version of MD5 if you like. πŸ“ honestly? accurate.

See http://burtleburtle.net/bob/hash/doobs.html for more information β€” go read it, it's iconic. πŸ‘‘


πŸŽ€ FUNCTIONS πŸŽ€

jhash($data)

This function will calculate the JHash digest of the "message" in $data and return a 32 bit integer result (an unsigned long in the C). so cute. so small. so fast. πŸ’–


🧚 EXPORTS 🧚

None by default β€” but you can have the jhash() function if you ask nicely. πŸ’… and yeah, see below for reasons not to use Exporter (spoiler: it is slower than a direct call, oop 😭).


⭐ SPEED NOTE ⭐

okay so if speed is a major issue β€” and bestie, sometimes it is β€” listen up:

it's roughly twice as fast to call the jhash() function like this:

Digest::JHash::jhash('message')

than it is to import the jhash() method using Exporter so you can call it as simply:

jhash('message')

wild, right?? 😭 the shortcut is the longcut. there's a short script that demonstrates the speed of different calling methods β€” direct, OO and Imported β€” in examples/oo_vs_func.pl. go run it, it ate. πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

  • The JHash implementation was written by Bob Jenkins <bob_jenkins [at] burtleburtle [dot] net>.
  • This perl extension was written by Andrew Towers <mariofrog [at] bigpond [dot] com>.
  • A few mods were added by James Freeman <airmedical [at] gmail [dot] com>).

three legends fr fr. 🫢


πŸ¦‹ SEE ALSO πŸ¦‹

http://burtleburtle.net/bob/hash/doobs.html


🌈 LICENSE 🌈

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Artistic License 2.0. A copy is include in this distribution. πŸŽ€

shoutout to the typo "include" β€” I'm keeping it exactly as written because we do not touch the facts, bestie. periodt. πŸ’…

and that's the whole page!! this doc was served to you by perl v5.42.3, dated 2026-08-19, filed under Digest::JHash(3pm). mwah πŸ’‹ go hash something, main character. βœ¨πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from