mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
76 lines
2.3 KiB
Plaintext
76 lines
2.3 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.
|
|
|
|
LINK LIBRARY
|
|
none
|
|
|
|
SEE ALSO
|
|
sha, sha1, md5
|
|
|
|
## Copyright (C) 1999 Landon Curt Noll
|
|
##
|
|
## Calc is open software; you can redistribute it and/or modify it under
|
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
|
## as published by the Free Software Foundation.
|
|
##
|
|
## Calc is distributed in the hope that it will be useful, but WITHOUT
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
|
## Public License for more details.
|
|
##
|
|
## A copy of version 2.1 of the GNU Lesser General Public License is
|
|
## distributed with calc under the filename COPYING-LGPL. You should have
|
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
|
##
|
|
## @(#) $Revision: 29.1 $
|
|
## @(#) $Id: hash,v 29.1 1999/12/14 09:15:52 chongo Exp $
|
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/hash,v $
|
|
##
|
|
## Under source code control: 1996/03/12 23:10:01
|
|
## File existed as early as: 1996
|
|
##
|
|
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
|
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|