/[dtapublic]/to_be_filed/webprojs/php_libraries/php_library/fboprime/crhsh.inc
ViewVC logotype

Contents of /to_be_filed/webprojs/php_libraries/php_library/fboprime/crhsh.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations) (download)
Sat Oct 8 23:35:33 2016 UTC (7 years, 5 months ago) by dashley
File size: 2228 byte(s)
Initial commit.
1 <?php
2 //$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/crhsh.inc,v 1.4 2006/04/08 07:14:16 dashley Exp $
3 //********************************************************************************
4 //Copyright (C)2006 David T. Ashley
5 //********************************************************************************
6 //This program or source file is free software; you can redistribute it and/or
7 //modify it under the terms of the GNU General Public License as published by
8 //the Free Software Foundation; either version 2 of the License, or (at your
9 //option) any later version.
10 //
11 //This program or source file is distributed in the hope that it will
12 //be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 //GNU General Public License for more details.
15 //
16 //You may have received a copy of the GNU General Public License
17 //along with this program; if not, write to the Free Software
18 //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //********************************************************************************
20 //Dave Ashley, 04/06
21 //
22 //This source file contains cryptographic hash function(s).
23 //
24 //The site hash key must be included, as this is used for all hashing functions.
25 //
26 require_once("sitehashkey.inc");
27 //
28 //As it turns out, because PHP provides for functions with variable numbers of arguments,
29 //only one function is required to meet all cryptographic hashing functions.
30 //
31 //--------------------------------------------------------------------------------
32 //The return value is an MD5 hash of the arguments intermingled with the key.
33 //
34 //The function is always deterministic (the same inputs will always produce the same
35 //output).
36 //
37 //Unit-tested 20060408.
38 //
39 function CRHSH_hashva()
40 {
41 $input = SITEHASHKEY_SITEHASHKEY;
42
43 $num_args = func_num_args();
44
45 for ($i=0; $i<$num_args; $i++)
46 {
47 $input .= ((string) func_get_arg($i));
48 $input .= SITEHASHKEY_SITEHASHKEY;
49 }
50
51 $rv = md5($input);
52
53 return($rv);
54 }
55 //--------------------------------------------------------------------------------
56 ?>

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25