mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
NAME
|
|
hash - FNV-1 hash value
|
|
|
|
SYNOPSIS
|
|
hash(x_1 [, x_2, x_3, ...])
|
|
|
|
TYPES
|
|
x_1, x_1, ... any
|
|
|
|
return integer v, 0 <= v < 2^32
|
|
|
|
DESCRIPTION
|
|
Returns a hash value for one or more values of arbitrary types.
|
|
|
|
The basis of this hash algorithm was taken from an idea sent
|
|
as reviewer comments to the IEEE POSIX P1003.2 committee by:
|
|
|
|
Phong Vo (http://www.research.att.com/info/kpv)
|
|
Glenn Fowler (http://www.research.att.com/~gsf/)
|
|
|
|
In a subsequent ballot round:
|
|
|
|
Landon Curt Noll (http://reality.sgi.com/chongo)
|
|
|
|
improved on their algorithm. Some people tried this hash
|
|
and found that it worked rather well. In an EMail message
|
|
to Landon, they named it ``Fowler/Noll/Vo'' or the FNV hash.
|
|
|
|
FNV hashes are architected to be fast while maintaining a low
|
|
collision rate. The FNV speed allows one to quickly hash lots
|
|
of data while maintaining a reasonable collision rate. See:
|
|
|
|
http://reality.sgi.com/chongo/tech/comp/fnv/
|
|
|
|
for more details as well as other forms of the FNV hash.
|
|
|
|
EXAMPLE
|
|
> a = isqrt(2e1000); s = "xyz";
|
|
> hash(a,s)
|
|
2378490456
|
|
|
|
LIMITS
|
|
The number of arguments is not to exceed 100.
|
|
|
|
LIBRARY
|
|
none
|
|
|
|
SEE ALSO
|
|
sha, sha1, md5
|