コード例 #1
0
<form>
	Username: <input id="username" /><br />
	Password: <input id="password" /><br />
	<input type="Submit" value="Generate QR Code" onclick="return login_submit();" />
</form>

<br /><br />

<strong>server-generated</strong><br />
<?php 
echo 'server_hash_x(symmetric, auth, ' . $su_config["sn"] . ', ' . $su_config["hash_client_salt"] . ', ' . $su_config["hash_l1_iterations"] . ') = ';
$hashx = hash_x('symmetric', 'auth', $su_config["sn"], $su_config["hash_client_salt"], $su_config["hash_l1_iterations"]);
echo $hashx . "<br />";
echo 'server_hash_z(symmetric, ' . $hashx . ', ' . $su_config["hash_server_z_salt"] . ', ' . $su_config["hash_l2_iterations"] . ') = ';
echo hash_z('symmetric', $hashx, $su_config["hash_server_z_salt"], $su_config["hash_l2_iterations"]);
?>

<br /><br />

<strong>client-generated</strong><br />
<div id="hash_log"></div>

<br /><br />

Scan the following QR code with the Pico app to continue: 

<br /><br />

<div id="qrcode"></div>
コード例 #2
0
function server_login($username, $password)
{
    require_once "server_user_config.php";
    return hash_z($username, $password, $su_config["hash_server_z_salt"], $su_config["hash_l2_iterations"]) === '32549c1102de0b930f3e4abee9f7d37c28ee4bff643491f6ebd86aad4a24cf95';
}