File: JHash.html

package info (click to toggle)
libdigest-jhash-perl 0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 297; makefile: 3
file content (129 lines) | stat: -rw-r--r-- 4,717 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JHash.pm</title>
<link rel="stylesheet" href="./html/docs.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" valign="middle">
<big><strong><span class="block">&nbsp;JHash.pm</span></strong></big>
</td></tr>
</table>


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

    <li><a href="#name">NAME</a></li>
    <li><a href="#synopsis">SYNOPSIS</a></li>
    <li><a href="#description">DESCRIPTION</a></li>
    <li><a href="#functions">FUNCTIONS</a></li>
    <li><a href="#exports">EXPORTS</a></li>
    <li><a href="#speed_note">SPEED NOTE</a></li>
    <li><a href="#authors">AUTHORS</a></li>
    <li><a href="#see_also">SEE ALSO</a></li>
    <li><a href="#license">LICENSE</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>Digest::JHash - Perl extension for 32 bit Jenkins Hashing Algorithm</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">Digest::JHash</span> <span class="string">qw(jhash)</span><span class="operator">;</span>
</pre>
<pre>
    <span class="variable">$digest</span> <span class="operator">=</span> <span class="variable">jhash</span><span class="operator">(</span><span class="variable">$data</span><span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># note that calling jhash() directly like this is the fastest way:</span>
</pre>
<pre>
    <span class="variable">$digest</span> <span class="operator">=</span> <span class="variable">Digest::JHash::jhash</span><span class="operator">(</span><span class="variable">$data</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <code>Digest::JHash</code> 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
&quot;message digest&quot; of the input in the form of an unsigned long integer.</p>
<p>Call it a low calorie version of MD5 if you like.</p>
<p>See <a href="http://burtleburtle.net/bob/hash/doobs.html">http://burtleburtle.net/bob/hash/doobs.html</a> for more information.</p>
<p>
</p>
<hr />
<h1><a name="functions">FUNCTIONS</a></h1>
<dl>
<dt><strong><a name="jhash" class="item"><code>jhash($data)</code></a></strong>

<dd>
<p>This function will calculate the JHash digest of the &quot;message&quot; in $data
and return a 32 bit integer result (an unsigned long in the C)</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="exports">EXPORTS</a></h1>
<p>None by default but you can have the <a href="#item_jhash"><code>jhash()</code></a> function if you ask nicely.
See below for reasons not to use Exporter (it is slower than a direct call)</p>
<p>
</p>
<hr />
<h1><a name="speed_note">SPEED NOTE</a></h1>
<p>If speed is a major issue it is roughly twice as fast to do call the <a href="#item_jhash"><code>jhash()</code></a>
function like Digest::JHash::jhash('message') than it is to import the
<a href="#item_jhash"><code>jhash()</code></a> 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</p>
<p>
</p>
<hr />
<h1><a name="authors">AUTHORS</a></h1>
<p>The JHash implementation was written by Bob Jenkins
&lt;bob_jenkins [at] burtleburtle [dot] net&gt;.</p>
<p>This perl extension was written by Andrew Towers
&lt;mariofrog [at] bigpond [dot] com&gt;.</p>
<p>A few mods were added by James Freeman
&lt;airmedical [at] gmail [dot] com&gt;).</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="http://burtleburtle.net/bob/hash/doobs.html">http://burtleburtle.net/bob/hash/doobs.html</a></p>
<p>
</p>
<hr />
<h1><a name="license">LICENSE</a></h1>
<p>This package is free software and is provided &quot;as is&quot; 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.</p>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" valign="middle">
<big><strong><span class="block">&nbsp;JHash.pm</span></strong></big>
</td></tr>
</table>

</body>

</html>