diff --git a/fn/auth.php b/fn/auth.php index c95588c..788125d 100644 --- a/fn/auth.php +++ b/fn/auth.php @@ -67,7 +67,7 @@ function setupDisplayUsername($display_username) { $key = sodium_crypto_aead_xchacha20poly1305_ietf_keygen(); $cyphertext = sodium_crypto_aead_xchacha20poly1305_ietf_encrypt( htmlspecialchars($display_username), - NULL, + '', $nonce, $key ); diff --git a/fn/common.php b/fn/common.php index 1e89ae4..fb751f9 100644 --- a/fn/common.php +++ b/fn/common.php @@ -2,7 +2,7 @@ function output($code, $msg = '', $logs = ['']) { http_response_code($code); - $shortCode = $code / 100 % 10; + $shortCode = intval($code / 100); if ($shortCode === 5) error_log('Internal error: ' . strip_tags($msg) . implode(LF, $logs)); $final_message = match ($shortCode) { diff --git a/router.php b/router.php index 9c81189..3fc244c 100644 --- a/router.php +++ b/router.php @@ -95,7 +95,7 @@ if (isset($_SESSION['id'])) { output(403, 'The display username decryption key has not been sent.'); $decryption_result = htmlspecialchars(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt( $_SESSION['display-username-cyphertext'], - NULL, + '', $_SESSION['display-username-nonce'], base64_decode($_COOKIE['display-username-decryption-key']) ));