[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 password_compat.php

Zen Cart 源代码 password_compat.php




下载文件

文件名: password_compat.php
文件类型: PHP文件
文件大小: 1.44 KiB
MD5: 3ff81ae9260c1f547d682fd6ce751318

password_compat.php - 关闭高亮
  1. <?php
  2. /**
  3.  * password_compat functions
  4. *
  5. * @package functions
  6. * @copyright Copyright 2003-2014 Zen Cart Development Team
  7. * @copyright Portions Copyright 2003 osCommerce
  8. * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9. * @version GIT: $Id: Author: Ian Wilson  Wed Feb 19 15:57:35 2014 +0000 New in v1.5.3 $
  10. */
  11. if (! defined('PASSWORD_DEFAULT')) {
  12.  
  13.   define('PASSWORD_BCRYPT', 1);
  14.   define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
  15.  
  16.   if (! function_exists('password_hash')) {
  17.     function password_hash($password, $algo = null)
  18.     {
  19.       return zen_encrypt_password_new($password);
  20.     }
  21.   }
  22.   if (! function_exists('password_verify')) {
  23.     function password_verify($plain, $encrypted)
  24.     {
  25.       if (zen_not_null($plain) && zen_not_null($encrypted)) {
  26.         $stack = explode(':', $encrypted);
  27.         if (sizeof($stack) != 2)
  28.           return false;
  29.         if (zcPassword::getInstance(PHP_VERSION)->validatePasswordOldMd5($plain, $encrypted) === true) {
  30.           return true;
  31.         } elseif (zcPassword::getInstance(PHP_VERSION)->validatePasswordCompatSha256($plain, $encrypted) === true) {
  32.           return true;
  33.         }
  34.       }
  35.       return false;
  36.     }
  37.   }
  38.   if (! function_exists('password_needs_rehash')) {
  39.     function password_needs_rehash($hash, $algo = null)
  40.     {
  41.       $tmp = explode(':', $hash);
  42.       if (count($tmp) == 2 && strlen($tmp [1]) == 2) {
  43.         return true;
  44.       } else {
  45.         return false;
  46.       }
  47.     }
  48.   }
  49. }