[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16469] API: new password hash
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16469] API: new password hash |
Date: |
Thu, 23 Mar 2017 10:34:36 -0400 (EDT) |
Revision: 16469
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16469
Author: sigurdne
Date: 2017-03-23 10:34:35 -0400 (Thu, 23 Mar 2017)
Log Message:
-----------
API: new password hash
Modified Paths:
--------------
trunk/phpgwapi/inc/auth/class.auth_.inc.php
trunk/setup/inc/hook_config.inc.php
Modified: trunk/phpgwapi/inc/auth/class.auth_.inc.php
===================================================================
--- trunk/phpgwapi/inc/auth/class.auth_.inc.php 2017-03-23 14:33:03 UTC (rev
16468)
+++ trunk/phpgwapi/inc/auth/class.auth_.inc.php 2017-03-23 14:34:35 UTC (rev
16469)
@@ -123,6 +123,12 @@
}
}
return $ret;
+
+ case 'BCRYPT':
+ $hash = password_hash($passwd,
PASSWORD_BCRYPT);
+ $ret = '{BCRYPT}' .
base64_encode($hash);
+ return $ret;
+
case 'MD5':
return "{MD5}" .
base64_encode(phpgwapi_common::hex2bin(md5($passwd)));
@@ -165,6 +171,12 @@
$salt = substr($hash, 63);
$hash = substr($hash, 0, 63);
return $hash === crypt($passwd, '$5$' .
$salt);
+
+ case 'BCRYPT':
+ $hash = base64_decode($hash);
+ $hash = substr($hash, 0, 60);
+ return password_verify($passwd, $hash);
+
case 'MD5':
$hash = bin2hex(base64_decode($hash));
return $hash === md5($passwd);
Modified: trunk/setup/inc/hook_config.inc.php
===================================================================
--- trunk/setup/inc/hook_config.inc.php 2017-03-23 14:33:03 UTC (rev 16468)
+++ trunk/setup/inc/hook_config.inc.php 2017-03-23 14:34:35 UTC (rev 16469)
@@ -184,6 +184,7 @@
{
$hashes = array
(
+ 'BCRYPT'=> lang('Salted BCrypt - strong encryption'),
'CRYPT' => lang('Salted Crypt - strong encryption'),
'SSHA' => lang('Salted SHA1 - strong encryption'),
'SMD5' => lang('Salted MD5'),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16469] API: new password hash,
sigurdne <=