From ec6d640ae523fed18a01fe0eb2e13bdfd354770a Mon Sep 17 00:00:00 2001 From: JensFalk Date: Mon, 21 Sep 2026 18:08:38 +0200 Subject: [PATCH] Fehlende ALTCHA-Bibliotheksdateien ergaenzt --- .../AltchaOrg/Altcha/V1/Hasher/Hasher.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 fp_altcha_spamschutz/src/Vendor/AltchaOrg/Altcha/V1/Hasher/Hasher.php diff --git a/fp_altcha_spamschutz/src/Vendor/AltchaOrg/Altcha/V1/Hasher/Hasher.php b/fp_altcha_spamschutz/src/Vendor/AltchaOrg/Altcha/V1/Hasher/Hasher.php new file mode 100644 index 0000000..739d4b0 --- /dev/null +++ b/fp_altcha_spamschutz/src/Vendor/AltchaOrg/Altcha/V1/Hasher/Hasher.php @@ -0,0 +1,34 @@ + sha1($data, true), + Algorithm::SHA256 => hash('sha256', $data, true), + Algorithm::SHA512 => hash('sha512', $data, true), + }; + } + + public function hashHex(Algorithm $algorithm, string $data): string + { + return bin2hex($this->hash($algorithm, $data)); + } + + public function hashHmac(Algorithm $algorithm, string $data, string $hmacKey): string + { + return match ($algorithm) { + Algorithm::SHA1 => hash_hmac('sha1', $data, $hmacKey, true), + Algorithm::SHA256 => hash_hmac('sha256', $data, $hmacKey, true), + Algorithm::SHA512 => hash_hmac('sha512', $data, $hmacKey, true), + }; + } + + public function hashHmacHex(Algorithm $algorithm, string $data, string $hmacKey): string + { + return bin2hex($this->hashHmac($algorithm, $data, $hmacKey)); + } +}