fix for php < 5.5.0
authorStricted <info@stricted.de>
Sun, 12 Jul 2015 16:30:28 +0000 (18:30 +0200)
committerStricted <info@stricted.de>
Sun, 12 Jul 2015 16:30:28 +0000 (18:30 +0200)
.gitignore
SpeedportHybrid.class.php

index c11eeeed6fc6ad572d9af9d9274d2c9e72068447..9dcd53da58589f67b4a7583d6079bf6fd3661a64 100644 (file)
@@ -2,3 +2,4 @@ tests/config.php
 tests/test.php
 .komodotools
 *.komodoproject
+rrd.php
index 3e40be4b1c7acc952a83751a0e5d56677c2a6344..319b97d13172b6717a8b4463af0a384c722c80f5 100644 (file)
@@ -95,7 +95,14 @@ class SpeedportHybrid {
                                }
                                
                                // calculate derivedk
-                               $this->derivedk = hash_pbkdf2('sha1', hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32);
+                               if (version_compare(phpversion(), '5.5.0', '<')) {
+                                       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);
+                               }
+                               else {
+                                       $this->derivedk = hash_pbkdf2('sha1', hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32);
+                               }
                                
                                // get the csrf_token
                                $this->token = $this->getToken();