Hey,

Is Blowfish een goede encryptie? Ik las op sommige plekken dat het langzaam is, klopt dat in de praktijk? En is het veilig?

Gr
Rustig maar, ik bedoel dat andere waar je het over had.
Snelle Jaap op 24/03/2014 15:24:58

Is Blowfish een goede encryptie? Ik las op sommige plekken dat het langzaam is, klopt dat in de praktijk? En is het veilig?

Blowfish is snel. De veiligheid hangt er een beetje vanaf; bepaalde soorten keys zijn erg zwak en dus eenvoudig te kraken.

Als alternatief zou ik AES of Twofish aanraden; die zijn iets beter.
Maar ik wil het hebben over Bcrypt...

Hoe ziet je huidige code er uit?
Ik zal mijn bcrypt class er ff in plempe

<?php
/* Create a new class called Bcrypt */
class Bcrypt {
private $rounds;
public function __construct($rounds = 12) {
if(CRYPT_BLOWFISH != 1) {
throw new Exception("Bcrypt is not supported on this server, please see the following to learn more: http://php.net/crypt";);
}
$this->rounds = $rounds;
}

/* Gen Salt */
private function genSalt() {

$string = str_shuffle(mt_rand());// generating a random string
$salt = uniqid($string ,true);// generating a random and unique string

/* Return */
return $salt;
}

/* Gen Hash */
public function genHash($password) {
/* 2y selects bcrypt algorithm */
/* $this->rounds is the workload factor, which is kept usually from 12 to 15 */

$hash = crypt($password, '$2y$' . $this->rounds . '$' . $this->genSalt());
/* Return */
return $hash;
}

/* Verify Password */
public function verify($password, $existingHash) {
/* Hash new password with old hash */
$hash = crypt($password, $existingHash);

/* Do Hashs match? */
if($hash === $existingHash) {
return true;
} else {
return false;
}
}
}
?>
Ik had hem getest op wamp dat ging prima, daarna overgezet op een testhost die blijkbaar nog een te oude versie had dus had maar weer sha1 gebruikt voor de passwords. Ga is kijken of ik het werkend kan krijgen op een oudere versie, thx.

Reageren