summaryrefslogtreecommitdiff
path: root/test/sha1.cc
blob: 24821badef0e902b98ada2400c7cfc698ad3d1f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "sha1.hh"

#include "base64.hh"

#include <gtest/gtest.h>

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("")));

  EXPECT_EQ("2jmj7l5rSw0yVb/vlWAYkK/YBwk=",
            base64::encode(sha1::hash(std::span<char>{})));
}