cvs: php4 /pear/Crypt CBC.php HCEMD5.php
| From: | Alexander Merz | Date: | Thu, 02 Aug 2001 15:23:00 +0000 |
| Subject: | cvs: php4 /pear/Crypt CBC.php HCEMD5.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-404@lists.php.net to get a copy of this message | ||
alexmerz Thu Aug 2 11:23:00 2001 EDT
Modified files:
/php4/pear/Crypt CBC.php HCEMD5.php
Log:
fix PHPDoc
Index: php4/pear/Crypt/CBC.php diff -u php4/pear/Crypt/CBC.php:1.8 php4/pear/Crypt/CBC.php:1.9 --- php4/pear/Crypt/CBC.php:1.8 Mon Apr 23 16:51:55 2001 +++ php4/pear/Crypt/CBC.php Thu Aug 2 11:23:00 2001 @@ -18,6 +18,14 @@ // +----------------------------------------------------------------------+ // +require_once 'PEAR.php'; + +if (function_exists('mcrypt_module_open')) { + define('CRYPT_CBC_USING_24x', 1); +} else { + define('CRYPT_CBC_USING_24x', 0); +} + /** * Class to emulate Perl's Crypt::CBC module * @@ -36,49 +44,76 @@ * the author of libcrypt decides to name things internally. * * -* @version $Id: CBC.php,v 1.8 2001/04/23 20:51:55 cmv Exp $ +* @version $Id: CBC.php,v 1.9 2001/08/02 15:23:00 alexmerz Exp $ * @author Colin Viebrock <colin@easydns.com> * @author Mike Glover <mpg4@duluoz.net> -* +* @access public +* @package Crypt */ - - -require_once 'PEAR.php'; - - - -if (function_exists('mcrypt_module_open')) { - define('CRYPT_CBC_USING_24x', 1); -} else { - define('CRYPT_CBC_USING_24x', 0); -} - - - class Crypt_CBC extends PEAR { + /** + * supported procedures + * @var array + */ var $known_ciphers = array ( 'DES' => MCRYPT_DES, 'BLOWFISH' => MCRYPT_BLOWFISH, 'BLOWFISH-COMPAT' => MCRYPT_BLOWFISH_COMPAT, ); - var $cipher; # used cipher - var $TD; # crypt resource, for 2.4.x - var $blocksize; # blocksize of cipher - var $keysize; # keysize of cipher - var $keyhash; # mangled key - var $rand_source = MCRYPT_RAND; # or MCRYPT_DEV_URANDOM or MCRYPT_DEV_RANDOM - var $header_spec = 'RandomIV'; # header - - var $_last_clear; # debugging - var $_last_crypt; # debugging - - + /** + * used cipher + * @var string + */ + var $cipher; + /** + * crypt resource, for 2.4.x + * @var string + */ + var $TD; + /** + * blocksize of cipher + * @var string + */ + var $blocksize; + /** + * keysize of cipher + * @var int + */ + var $keysize; + /** + * mangled key + * @var string + */ + var $keyhash; + /** + * source type of the initialization vector for creation + * possible types are MCRYPT_RAND or MCRYPT_DEV_URANDOM or MCRYPT_DEV_RANDOM + * @var int + */ + var $rand_source = MCRYPT_RAND; + /** + * header + * @var string + */ + var $header_spec = 'RandomIV'; + /** + * debugging + * @var string + */ + var $_last_clear; + /** + * debugging + * @var string + */ + var $_last_crypt; /** * Constructor + * $key is the key to use for encryption. $cipher can be DES, BLOWFISH or + * BLOWFISH-COMPAT * * @param $key encryption key * @param $cipher which algorithm to use, defaults to DES @@ -276,12 +311,35 @@ } +/** +* Inherit from PEAR_Error +* used to create a specific error message +* @access public +* @package Crypt +*/ class Crypt_CBC_Error extends PEAR_Error { - var $classname = 'Crypt_CBC_Error'; + /** + * Name of the this class + * @var string + */ + var $classname = 'Crypt_CBC_Error'; + /** + * first part of the error message + * @var string + */ var $error_message_prepend = 'Error in Crypt_CBC'; + /** + * creates a new error object + * @param string $message error message + * @param int $code error code + * @param int $mode error mode + * @param int $level error level + * @return object PEAR_Error PEAR_Error object + * @access public + */ function Crypt_CBC_Error ($message, $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) { $this->PEAR_Error ($message, $code, $mode, $level); Index: php4/pear/Crypt/HCEMD5.php diff -u php4/pear/Crypt/HCEMD5.php:1.5 php4/pear/Crypt/HCEMD5.php:1.6 --- php4/pear/Crypt/HCEMD5.php:1.5 Tue Jan 9 20:01:53 2001 +++ php4/pear/Crypt/HCEMD5.php Thu Aug 2 11:23:00 2001 @@ -17,52 +17,56 @@ // | Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ -/* - Description: - - The MIME Functions are tested and work symmetrically with the - Crypt::HCE_MD5 package (0.45) (without the KEYBUG Flag ..). - - Shamelessly stolen from Eric Estabrooks, eric@urbanrage.com - Crypt::HCE_MD5 package: - - This package implements a chaining block cipher using a one way - hash. This method of encryption is the same that is used by radius - (RFC2138) and is also described in Applied Cryptography by Bruce - Schneider (p. 353 / "Karn"). - - Two interfaces are provided in the package. The first is straight - block encryption/decryption the second does base64 mime - encoding/decoding of the encrypted/decrypted blocks. - - The idea is the the two sides have a shared secret that supplies one - of the keys and a randomly generated block of bytes provides the - second key. The random key is passed in cleartext between the two - sides. - - Usage: - require_once 'Crypt/HCEMD5.php'; - $key = 'my secret key'; - srand((double)microtime()*32767); - $rand = rand(1, 32767); - $rand = pack('i*', $rand); - $message = 'text to encrypt'; - $hcemd5 = new Crypt_HCEMD5($key, $rand); - - // These Functions work with mime decoded Data - $ciphertext = $hcemd5->encodeMime($message); - $cleartext = $hcemd5->decodeMime($ciphertext); - - // These Functions work with binary Data - $ciphertext = $hcemd5->encrypt($message); - $cleartext = $hcemd5->decrypt($ciphertext); - - // These Functions work with mime decoded Data the selfrand - // functions put the random value infront of the encrypted data to - // be restored later - $ciphertext = $hcemd5->encodeMimeSelfRand($message); - $new_hcemd5 = new Crypt_HCEMD5($key, ''); - $cleartext = $new_hcemd5->DecodeMimeSelfRand($ciphertext); +/** +* Class to emulate Perl's Crypt::HCE_MD5 module +* +* The MIME Functions are tested and work symmetrically with the +* Crypt::HCE_MD5 package (0.45) (without the KEYBUG Flag ..). +* +* Shamelessly stolen from Eric Estabrooks, eric@urbanrage.com +* Crypt::HCE_MD5 package: +* +* This package implements a chaining block cipher using a one way +* hash. This method of encryption is the same that is used by radius +* (RFC2138) and is also described in Applied Cryptography by Bruce +* Schneider (p. 353 / "Karn"). +* +* Two interfaces are provided in the package. The first is straight +* block encryption/decryption the second does base64 mime +* encoding/decoding of the encrypted/decrypted blocks. +* +* The idea is the the two sides have a shared secret that supplies one +* of the keys and a randomly generated block of bytes provides the +* second key. The random key is passed in cleartext between the two +* sides. +* +* Usage: +* require_once 'Crypt/HCEMD5.php'; +* $key = 'my secret key'; +* srand((double)microtime()*32767); +* $rand = rand(1, 32767); +* $rand = pack('i*', $rand); +* $message = 'text to encrypt'; +* $hcemd5 = new Crypt_HCEMD5($key, $rand); +* +* // These Functions work with mime decoded Data +* $ciphertext = $hcemd5->encodeMime($message); +* $cleartext = $hcemd5->decodeMime($ciphertext); +* +* // These Functions work with binary Data +* $ciphertext = $hcemd5->encrypt($message); +* $cleartext = $hcemd5->decrypt($ciphertext); +* +* // These Functions work with mime decoded Data the selfrand +* // functions put the random value infront of the encrypted data to +* // be restored later +* $ciphertext = $hcemd5->encodeMimeSelfRand($message); +* $new_hcemd5 = new Crypt_HCEMD5($key, ''); +* $cleartext = $new_hcemd5->DecodeMimeSelfRand($ciphertext); +* +* @version $Id: HCEMD5.php,v 1.6 2001/08/02 15:23:00 alexmerz Exp $ +* @access public +* @package Crypt */ class Crypt_HCEMD5 {
Index: php4/pear/Crypt/CBC.php diff -u php4/pear/Crypt/CBC.php:1.8 php4/pear/Crypt/CBC.php:1.9 --- php4/pear/Crypt/CBC.php:1.8 Mon Apr 23 16:51:55 2001 +++ php4/pear/Crypt/CBC.php Thu Aug 2 11:23:00 2001 @@ -18,6 +18,14 @@ // +----------------------------------------------------------------------+ // +require_once 'PEAR.php'; + +if (function_exists('mcrypt_module_open')) { + define('CRYPT_CBC_USING_24x', 1); +} else { + define('CRYPT_CBC_USING_24x', 0); +} + /** * Class to emulate Perl's Crypt::CBC module * @@ -36,49 +44,76 @@ * the author of libcrypt decides to name things internally. * * -* @version $Id: CBC.php,v 1.8 2001/04/23 20:51:55 cmv Exp $ +* @version $Id: CBC.php,v 1.9 2001/08/02 15:23:00 alexmerz Exp $ * @author Colin Viebrock <colin@easydns.com> * @author Mike Glover <mpg4@duluoz.net> -* +* @access public +* @package Crypt */ - - -require_once 'PEAR.php'; - - - -if (function_exists('mcrypt_module_open')) { - define('CRYPT_CBC_USING_24x', 1); -} else { - define('CRYPT_CBC_USING_24x', 0); -} - - - class Crypt_CBC extends PEAR { + /** + * supported procedures + * @var array + */ var $known_ciphers = array ( 'DES' => MCRYPT_DES, 'BLOWFISH' => MCRYPT_BLOWFISH, 'BLOWFISH-COMPAT' => MCRYPT_BLOWFISH_COMPAT, ); - var $cipher; # used cipher - var $TD; # crypt resource, for 2.4.x - var $blocksize; # blocksize of cipher - var $keysize; # keysize of cipher - var $keyhash; # mangled key - var $rand_source = MCRYPT_RAND; # or MCRYPT_DEV_URANDOM or MCRYPT_DEV_RANDOM - var $header_spec = 'RandomIV'; # header - - var $_last_clear; # debugging - var $_last_crypt; # debugging - - + /** + * used cipher + * @var string + */ + var $cipher; + /** + * crypt resource, for 2.4.x + * @var string + */ + var $TD; + /** + * blocksize of cipher + * @var string + */ + var $blocksize; + /** + * keysize of cipher + * @var int + */ + var $keysize; + /** + * mangled key + * @var string + */ + var $keyhash; + /** + * source type of the initialization vector for creation + * possible types are MCRYPT_RAND or MCRYPT_DEV_URANDOM or MCRYPT_DEV_RANDOM + * @var int + */ + var $rand_source = MCRYPT_RAND; + /** + * header + * @var string + */ + var $header_spec = 'RandomIV'; + /** + * debugging + * @var string + */ + var $_last_clear; + /** + * debugging + * @var string + */ + var $_last_crypt; /** * Constructor + * $key is the key to use for encryption. $cipher can be DES, BLOWFISH or + * BLOWFISH-COMPAT * * @param $key encryption key * @param $cipher which algorithm to use, defaults to DES @@ -276,12 +311,35 @@ } +/** +* Inherit from PEAR_Error +* used to create a specific error message +* @access public +* @package Crypt +*/ class Crypt_CBC_Error extends PEAR_Error { - var $classname = 'Crypt_CBC_Error'; + /** + * Name of the this class + * @var string + */ + var $classname = 'Crypt_CBC_Error'; + /** + * first part of the error message + * @var string + */ var $error_message_prepend = 'Error in Crypt_CBC'; + /** + * creates a new error object + * @param string $message error message + * @param int $code error code + * @param int $mode error mode + * @param int $level error level + * @return object PEAR_Error PEAR_Error object + * @access public + */ function Crypt_CBC_Error ($message, $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) { $this->PEAR_Error ($message, $code, $mode, $level); Index: php4/pear/Crypt/HCEMD5.php diff -u php4/pear/Crypt/HCEMD5.php:1.5 php4/pear/Crypt/HCEMD5.php:1.6 --- php4/pear/Crypt/HCEMD5.php:1.5 Tue Jan 9 20:01:53 2001 +++ php4/pear/Crypt/HCEMD5.php Thu Aug 2 11:23:00 2001 @@ -17,52 +17,56 @@ // | Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ -/* - Description: - - The MIME Functions are tested and work symmetrically with the - Crypt::HCE_MD5 package (0.45) (without the KEYBUG Flag ..). - - Shamelessly stolen from Eric Estabrooks, eric@urbanrage.com - Crypt::HCE_MD5 package: - - This package implements a chaining block cipher using a one way - hash. This method of encryption is the same that is used by radius - (RFC2138) and is also described in Applied Cryptography by Bruce - Schneider (p. 353 / "Karn"). - - Two interfaces are provided in the package. The first is straight - block encryption/decryption the second does base64 mime - encoding/decoding of the encrypted/decrypted blocks. - - The idea is the the two sides have a shared secret that supplies one - of the keys and a randomly generated block of bytes provides the - second key. The random key is passed in cleartext between the two - sides. - - Usage: - require_once 'Crypt/HCEMD5.php'; - $key = 'my secret key'; - srand((double)microtime()*32767); - $rand = rand(1, 32767); - $rand = pack('i*', $rand); - $message = 'text to encrypt'; - $hcemd5 = new Crypt_HCEMD5($key, $rand); - - // These Functions work with mime decoded Data - $ciphertext = $hcemd5->encodeMime($message); - $cleartext = $hcemd5->decodeMime($ciphertext); - - // These Functions work with binary Data - $ciphertext = $hcemd5->encrypt($message); - $cleartext = $hcemd5->decrypt($ciphertext); - - // These Functions work with mime decoded Data the selfrand - // functions put the random value infront of the encrypted data to - // be restored later - $ciphertext = $hcemd5->encodeMimeSelfRand($message); - $new_hcemd5 = new Crypt_HCEMD5($key, ''); - $cleartext = $new_hcemd5->DecodeMimeSelfRand($ciphertext); +/** +* Class to emulate Perl's Crypt::HCE_MD5 module +* +* The MIME Functions are tested and work symmetrically with the +* Crypt::HCE_MD5 package (0.45) (without the KEYBUG Flag ..). +* +* Shamelessly stolen from Eric Estabrooks, eric@urbanrage.com +* Crypt::HCE_MD5 package: +* +* This package implements a chaining block cipher using a one way +* hash. This method of encryption is the same that is used by radius +* (RFC2138) and is also described in Applied Cryptography by Bruce +* Schneider (p. 353 / "Karn"). +* +* Two interfaces are provided in the package. The first is straight +* block encryption/decryption the second does base64 mime +* encoding/decoding of the encrypted/decrypted blocks. +* +* The idea is the the two sides have a shared secret that supplies one +* of the keys and a randomly generated block of bytes provides the +* second key. The random key is passed in cleartext between the two +* sides. +* +* Usage: +* require_once 'Crypt/HCEMD5.php'; +* $key = 'my secret key'; +* srand((double)microtime()*32767); +* $rand = rand(1, 32767); +* $rand = pack('i*', $rand); +* $message = 'text to encrypt'; +* $hcemd5 = new Crypt_HCEMD5($key, $rand); +* +* // These Functions work with mime decoded Data +* $ciphertext = $hcemd5->encodeMime($message); +* $cleartext = $hcemd5->decodeMime($ciphertext); +* +* // These Functions work with binary Data +* $ciphertext = $hcemd5->encrypt($message); +* $cleartext = $hcemd5->decrypt($ciphertext); +* +* // These Functions work with mime decoded Data the selfrand +* // functions put the random value infront of the encrypted data to +* // be restored later +* $ciphertext = $hcemd5->encodeMimeSelfRand($message); +* $new_hcemd5 = new Crypt_HCEMD5($key, ''); +* $cleartext = $new_hcemd5->DecodeMimeSelfRand($ciphertext); +* +* @version $Id: HCEMD5.php,v 1.6 2001/08/02 15:23:00 alexmerz Exp $ +* @access public +* @package Crypt */ class Crypt_HCEMD5 {