1.\" $NetBSD: elf_hash.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2.\" 3.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" This software is provided by Joseph Koshy ``as is'' and 15.\" any express or implied warranties, including, but not limited to, the 16.\" implied warranties of merchantability and fitness for a particular purpose 17.\" are disclaimed. in no event shall Joseph Koshy be liable 18.\" for any direct, indirect, incidental, special, exemplary, or consequential 19.\" damages (including, but not limited to, procurement of substitute goods 20.\" or services; loss of use, data, or profits; or business interruption) 21.\" however caused and on any theory of liability, whether in contract, strict 22.\" liability, or tort (including negligence or otherwise) arising in any way 23.\" out of the use of this software, even if advised of the possibility of 24.\" such damage. 25.\" 26.\" Id: elf_hash.3 189 2008-07-20 10:38:08Z jkoshy 27.\" 28.Dd August 15, 2006 29.Os 30.Dt ELF_HASH 3 31.Sh NAME 32.Nm elf_hash 33.Nd compute a hash value for a string 34.Sh LIBRARY 35.Lb libelf 36.Sh SYNOPSIS 37.In libelf.h 38.Ft "unsigned long" 39.Fn elf_hash "const char *name" 40.Sh DESCRIPTION 41Function 42.Fn elf_hash 43computes a portable hash value for the null terminated string 44pointed to by argument 45.Ar name . 46.Pp 47The hash value returned is will be identical across 48machines of different architectures. 49This allows hash tables to be built on one machine and 50correctly used on another of a different architecture. 51The hash value returned is also guaranteed 52.Em not 53to be the bit pattern of all ones (~0UL). 54.Sh IMPLEMENTATION NOTES 55The library internally uses unsigned 32 bit arithmetic to compute 56the hash value. 57.Sh SEE ALSO 58.Xr elf 3 , 59.Xr gelf 3 60