From bd9654370938ccc06ea1f2edb07a00f074ac0618 Mon Sep 17 00:00:00 2001 From: Vaidas Lungis Date: Thu, 13 Nov 2014 13:23:53 +0200 Subject: [PATCH] Box_Password class created as a wrapper of password_* functions --- src/bb-library/Box/Password.php | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/bb-library/Box/Password.php diff --git a/src/bb-library/Box/Password.php b/src/bb-library/Box/Password.php new file mode 100644 index 000000000..1eaa3a9d4 --- /dev/null +++ b/src/bb-library/Box/Password.php @@ -0,0 +1,42 @@ +algo = $algo; + } + + public function setOptions($options = array()) + { + $this->options = $options; + } + + public function hashIt($password) + { + return password_hash($password, $this->algo, $this->options); + } + + public function verify ($password, $hash) + { + return password_verify((string) $password, $hash); + } + + public function needsRehash($hash) + { + return password_needs_rehash($hash, $this->algo, $this->options); + } +} \ No newline at end of file