Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

digest::jhash(3pm) [debian man page]

Digest::JHash(3pm)					User Contributed Perl Documentation					Digest::JHash(3pm)

NAME
Digest::JHash - Perl extension for 32 bit Jenkins Hashing Algorithm 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); DESCRIPTION
The "Digest::JHash" module allows you to use the fast JHash hashing algorithm developed by Bob Jenkins from within Perl programs. 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. Call it a low calorie version of MD5 if you like. See http://burtleburtle.net/bob/hash/doobs.html for more information. 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) EXPORTS
None by default but you can have the jhash() function if you ask nicely. See below for reasons not to use Exporter (it is slower than a direct call) SPEED NOTE
If speed is a major issue it is roughly twice as fast to do call the jhash() function like Digest::JHash::jhash('message') than it is to import the jhash() method using Exporter so you can call it as simply jhash('message'). There is a short script that demonstrates the speed of different calling methods (direct, OO and Imported) in examples/oo_vs_func.pl 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>). 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. perl v5.14.2 2010-07-26 Digest::JHash(3pm)

Check Out this Related Man Page

Digest(3pm)						 Perl Programmers Reference Guide					       Digest(3pm)

NAME
Digest:: - Modules that calculate message digests SYNOPSIS
$md2 = Digest->MD2; $md5 = Digest->MD5; $sha1 = Digest->SHA1; $sha1 = Digest->new("SHA-1"); $hmac = Digest->HMAC_MD5($key); DESCRIPTION
The "Digest::" modules calculate digests, also called "fingerprints" or "hashes", of some data, called a message. The digest is (usually) some small/fixed size string. The actual size of the digest depend of the algorithm used. The message is simply a sequence of arbitrary bytes. An important property of the digest algorithms is that the digest is likely to change if the message change in some way. Another property is that digest functions are one-way functions, i.e. it should be hard to find a message that correspond to some given digest. Algorithms differ in how "likely" and how "hard", as well as how efficient they are to compute. All "Digest::" modules provide the same programming interface. A functional interface for simple use, as well as an object oriented inter- face that can handle messages of arbitrary length and which can read files directly. The digest can be delivered in three formats: binary This is the most compact form, but it is not well suited for printing or embedding in places that can't handle arbitrary data. hex A twice as long string of (lowercase) hexadecimal digits. base64 A string of portable printable characters. This is the base64 encoded representation of the digest with any trailing padding removed. The string will be about 30% longer than the binary version. MIME::Base64 tells you more about this encoding. The functional interface is simply importable functions with the same name as the algorithm. The functions take the message as argument and return the digest. Example: use Digest::MD5 qw(md5); $digest = md5($message); There are also versions of the functions with "_hex" or "_base64" appended to the name, which returns the digest in the indicated form. OO INTERFACE
The following methods are available for all "Digest::" modules: $ctx = Digest->XXX($arg,...) $ctx = Digest->new(XXX => $arg,...) $ctx = Digest::XXX->new($arg,...) The constructor returns some object that encapsulate the state of the message-digest algorithm. You can add data to the object and finally ask for the digest. The "XXX" should of course be replaced by the proper name of the digest algorithm you want to use. The two first forms are simply syntactic sugar which automatically load the right module on first use. The second form allow you to use algorithm names which contains letters which are not legal perl identifiers, e.g. "SHA-1". If new() is called as an instance method (i.e. $ctx->new) it will just reset the state the object to the state of a newly created object. No new object is created in this case, and the return value is the reference to the object (i.e. $ctx). $ctx->reset This is just an alias for $ctx->new. $ctx->add($data,...) The $data provided as argument are appended to the message we calculate the digest for. The return value is the $ctx object itself. $ctx->addfile($io_handle) The $io_handle is read until EOF and the content is appended to the message we calculate the digest for. The return value is the $ctx object itself. $ctx->digest Return the binary digest for the message. Note that the "digest" operation is effectively a destructive, read-once operation. Once it has been performed, the $ctx object is automatically "reset" and can be used to calculate another digest value. $ctx->hexdigest Same as $ctx->digest, but will return the digest in hexadecimal form. $ctx->b64digest Same as $ctx->digest, but will return the digest as a base64 encoded string. SEE ALSO
Digest::MD5, Digest::SHA1, Digest::HMAC, Digest::MD2 MIME::Base64 AUTHOR
Gisle Aas <gisle@aas.no> The "Digest::" interface is based on the interface originally developed by Neil Winton for his "MD5" module. perl v5.8.0 2002-06-01 Digest(3pm)
Man Page