<?php
/**
 * class password
 *
 * Description for class password
 *
 * @author:
*/
namespace core;

class password {
	public static function salt() {
		return mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);
	}

	public static function hash($password, $salt = "", $cost = 12) {
		if(empty($salt)) {
			$salt = self::salt();
		}

		return password_hash($password, PASSWORD_BCRYPT, array("cost" => $cost, "salt" => $salt));
	}

	public static function verify($password, $hash) {
		return password_verify($password, $hash);
	}
}
?>