projects
/
GitHub
/
Stricted
/
speedport-hybrid-php-api.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d6ff8a
)
fix derivedk calculation
1.0.0
author
Stricted
<info@stricted.de>
Mon, 13 Jul 2015 12:46:52 +0000
(14:46 +0200)
committer
Stricted
<info@stricted.de>
Mon, 13 Jul 2015 12:46:52 +0000
(14:46 +0200)
SpeedportHybrid.class.php
patch
|
blob
|
blame
|
history
diff --git
a/SpeedportHybrid.class.php
b/SpeedportHybrid.class.php
index 319b97d13172b6717a8b4463af0a384c722c80f5..81152c31498f3ed9a3e90e66a8e631254e7dab53 100644
(file)
--- a/
SpeedportHybrid.class.php
+++ b/
SpeedportHybrid.class.php
@@
-95,10
+95,11
@@
class SpeedportHybrid {
}
// calculate derivedk
}
// calculate derivedk
- if (
version_compare(phpversion(), '5.5.0', '<'
)) {
+ if (
!function_exists("hash_pbkdf2"
)) {
require_once 'CryptLib/CryptLib.php';
require_once 'CryptLib/CryptLib.php';
- $pbkdf2 = new CryptLib\Key\Derivation\PBKDF\PBKDF2();
- $this->derivedk = $pbkdf2->derive(hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32);
+ $pbkdf2 = new CryptLib\Key\Derivation\PBKDF\PBKDF2(array('hash' => 'sha1'));
+ $this->derivedk = bin2hex($pbkdf2->derive(hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32));
+ $this->derivedk = substr($this->derivedk, 0, 32);
}
else {
$this->derivedk = hash_pbkdf2('sha1', hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32);
}
else {
$this->derivedk = hash_pbkdf2('sha1', hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32);