mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-15 06:01:19 +00:00
add new function createNonce()
This commit is contained in:
parent
124c3c70a3
commit
f0d5821bd1
|
@ -632,6 +632,22 @@ function seed_pass_verify($password, $hash) { /* {{{ */
|
||||||
return $hash == md5($password);
|
return $hash == md5($password);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return nonce for CSP
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function createNonce() { /* {{{ */
|
||||||
|
$length = 16;
|
||||||
|
$usable = true;
|
||||||
|
$bytes = openssl_random_pseudo_bytes($length, $usable);
|
||||||
|
if ($usable === false) {
|
||||||
|
// weak
|
||||||
|
// @TODO do something?
|
||||||
|
}
|
||||||
|
return base64_encode($bytes);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for creating encrypted api keys
|
* Class for creating encrypted api keys
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user