Audacity 3.2.0
CryptoTests.cpp
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-or-later
3 * SPDX-FileName: CryptoTests.cpp
4 * SPDX-FileContributor: Dmitry Vedenko
5 */
6
7#include <catch2/catch.hpp>
8
9#include "crypto/SHA256.h"
10
11TEST_CASE("SHA256", "")
12{
14
15 REQUIRE(sha256.Finalize() == "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855");
16
17 sha256.Update("a");
18
19 REQUIRE(
20 sha256.Finalize() ==
21 "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB");
22
23 sha256.Update("bc", 2);
24
25 REQUIRE(
26 sha256.Finalize() ==
27 "1E0BBD6C686BA050B8EB03FFEEDC64FDC9D80947FCE821ABBE5D6DC8D252C5AC");
28
29 REQUIRE(
30 crypto::sha256("Audacity") ==
31 "CF21DBCF13FC6B66CCBF713B88AD02EC1EF0C6196ACAF28B0FB48D04858A5D04");
32
33 REQUIRE(
35 " is a free, open source, cross-platform audio software for multi-track recording and editing.") ==
36 "00E7C81A5357B1734035CE4CAE5DC0B3F886D22C8AF2E3952E2F5569A994B8A8");
37}
TEST_CASE("SHA256", "")
Definition: CryptoTests.cpp:11
std::string sha256(const T &data)
Definition: SHA256.h:50