Crypt_Hash

# Procedural File: Hash.php

Source Location: /lib/3rdParty/phpseclib/Crypt/Hash.php

## Classes:

Crypt_Hash
  Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions.

## Page Details:

Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions.

Uses hash() or mhash() if available and an internal implementation, otherwise. Currently supports the following:

md2, md5, md5-96, sha1, sha1-96, sha256, sha384, and sha512

If setKey() is called, hash() will return the HMAC as opposed to the hash. If no valid algorithm is provided, sha1 will be used.

PHP versions 4 and 5

Here's a short example of how to use this library:

1. <?php
2. include('Crypt/Hash.php');
4. $hash = new Crypt_Hash ('sha1');
6. $hash->setKey('abcdefg');
8. echo base64_encode ($hash-> hash ('abcdefg'));
9. ?>

LICENSE: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library 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.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#### Tags:

author: | Jim Wigginton <terrafrost@php.net>
version: | $Id: Hash.php,v 1.1 2010/05/14 14:06:16 gruberroland Exp $
copyright: | MMVII Jim Wigginton
link: | http://phpseclib.sourceforge.net
license: | http://www.gnu.org/licenses/lgpl.txt

Documentation generated on Thu, 28 Oct 2010 21:00:15 +0200 by phpDocumentor 1.4.1