File: cipher.cpp

package info (click to toggle)
libqtshadowsocks 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 412 kB
  • sloc: cpp: 3,315; makefile: 8
file content (28 lines) | stat: -rw-r--r-- 681 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <QtTest>
#include "crypto/cipher.h"
#include "util/common.h"

class Cipher : public QObject
{
    Q_OBJECT

public:
    Cipher() = default;

private Q_SLOTS:
    // Test md5Hash() function using test cases from
    // http://www.nsrl.nist.gov/testdata/
    void testMd5Hash();
};

void Cipher::testMd5Hash()
{
    std::string in("abc");
    QCOMPARE(QSS::Cipher::md5Hash(in), QSS::Common::stringFromHex("900150983CD24FB0D6963F7D28E17F72"));

    in = std::string("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq");
    QCOMPARE(QSS::Cipher::md5Hash(in), QSS::Common::stringFromHex("8215EF0796A20BCAAAE116D3876C664A"));
}

QTEST_MAIN(Cipher)
#include "cipher.moc"