import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -1,5 +1,30 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Crypt
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Crypt.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
* @category Zend
* @package Zend_Crypt
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Crypt
{
@ -9,6 +34,9 @@ class Zend_Crypt
protected static $_type = null;
/**
* @var array
*/
protected static $_supportedAlgosOpenssl = array(
'md2',
'md4',
@ -22,6 +50,9 @@ class Zend_Crypt
'sha512'
);
/**
* @var array
*/
protected static $_supportedAlgosMhash = array(
'adler32',
'crc32',
@ -41,6 +72,12 @@ class Zend_Crypt
'tiger160'
);
/**
* @param string $algorithm
* @param string $data
* @param bool $binaryOutput
* @return unknown
*/
public static function hash($algorithm, $data, $binaryOutput = false)
{
$algorithm = strtolower($algorithm);
@ -52,6 +89,10 @@ class Zend_Crypt
$result = self::$supportedMethod($algorithm, $data, $binaryOutput);
}
/**
* @param string $algorithm
* @throws Zend_Crypt_Exception
*/
protected static function _detectHashSupport($algorithm)
{
if (function_exists('hash')) {
@ -75,15 +116,30 @@ class Zend_Crypt
return;
}
}
/**
* @see Zend_Crypt_Exception
*/
require_once 'Zend/Crypt/Exception.php';
throw new Zend_Crypt_Exception('\'' . $algorithm . '\' is not supported by any available extension or native function');
}
/**
* @param string $algorithm
* @param string $data
* @param bool $binaryOutput
* @return string
*/
protected static function _digestHash($algorithm, $data, $binaryOutput)
{
return hash($algorithm, $data, $binaryOutput);
}
/**
* @param string $algorithm
* @param string $data
* @param bool $binaryOutput
* @return string
*/
protected static function _digestMhash($algorithm, $data, $binaryOutput)
{
$constant = constant('MHASH_' . strtoupper($algorithm));
@ -94,6 +150,12 @@ class Zend_Crypt
return bin2hex($binary);
}
/**
* @param string $algorithm
* @param string $data
* @param bool $binaryOutput
* @return string
*/
protected static function _digestOpenssl($algorithm, $data, $binaryOutput)
{
if ($algorithm == 'ripemd160') {