],$opt));
}
+ public function ssha512_password($password='',$salt='') {
+ if (empty($password)) return $password;
+ if ($salt === '') $salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4);
+ $password = '{SSHA512}' . base64_encode(hash('sha512', $password . $salt). $salt);
+ return $password;
+ }
public function ssha_password($password='') {
if (empty($password)) return $password;
$salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4);
exit;
}
+ public function ssha512_password($password='') {
+ if ($password=='') {
+ if ($password=='') $password = $this->params['table'];
+ if ($password=='' and !empty($_POST['password'])) $password = $_POST['password'];
+ if ($this->is_html) echo <<<EOF
+<form action="$this->uri" method="post" class="block" style="padding:1.5em">
+<label>Password</label><input type="text" name="password" value="$password" />
+<input type="submit" />
+</form>
+EOF;
+ }
+ return $this->db->ssha512_password($password);
+ }
+
public function ssha_password($password='') {
if ($password=='') {
if ($password=='') $password = $this->params['table'];
[ 'databases', 'List others databases' ],
[ 'cryptkey', 'Generate a random encryption key' ],
[ 'ssha_password', 'Encrypt a password' ],
+ [ 'ssha512_password', 'Encrypt a password' ],
[ 'logout', 'Clear Basic Auth' ],
[ 'status', 'Status infos page' ],
],['command','description'],function(&$r) {
} elseif ($action == 'ssha_password') {
$this->page($this,'ssha_password');
+ } elseif ($action == 'ssha512_password') {
+ $this->page($this,'ssha512_password');
+
} elseif ($action == 'cryptkey') {
$this->page($this->db,'cryptkey',['key']);