From f1b1880cf01a8abb6016954e51b46c453c3d6d94 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 19 Oct 2025 00:09:53 +0200 Subject: sha1: Add new module SHA1 hasher. Needed by websocket support that is coming soon. Using either libmd or openssl to do the actual hashing. --- test/sha1.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/sha1.cc (limited to 'test/sha1.cc') diff --git a/test/sha1.cc b/test/sha1.cc new file mode 100644 index 0000000..7441f01 --- /dev/null +++ b/test/sha1.cc @@ -0,0 +1,17 @@ +#include "sha1.hh" + +#include "base64.hh" + +#include + +TEST(Sha1, sanity) { + EXPECT_EQ("L9ThxnotKPzthJ7hu3bnORuT6xI=", + base64::encode( + sha1::hash("The quick brown fox jumps over the lazy dog"))); + + EXPECT_EQ("3p8sf9JeGzr60+haC9F9mxANtLM=", + base64::encode( + sha1::hash("The quick brown fox jumps over the lazy cog"))); + + EXPECT_EQ("2jmj7l5rSw0yVb/vlWAYkK/YBwk=", base64::encode(sha1::hash(""))); +} -- cgit v1.2.3-70-g09d2