File: md5.cpp

package info (click to toggle)
mldemos 0.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,224 kB
  • ctags: 46,525
  • sloc: cpp: 306,887; ansic: 167,718; ml: 126; sh: 109; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (4)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (C) 2007  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.


#include <dlib/md5.h>
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>

#include "tester.h"

namespace  
{

    using namespace test;
    using namespace dlib;
    using namespace std;

    logger dlog("test.md5");

    void md5_test (
    )
    /*!
        ensures
            - runs tests on the md5 stuff compliance with the specs
    !*/
    {        

        DLIB_TEST(md5 ("") == "d41d8cd98f00b204e9800998ecf8427e");
        DLIB_TEST(md5 ("a") == "0cc175b9c0f1b6a831c399e269772661");
        DLIB_TEST(md5 ("abc") == "900150983cd24fb0d6963f7d28e17f72");
        DLIB_TEST(md5 ("message digest") == "f96b697d7cb7938d525a2f31aaf161d0");
        DLIB_TEST(md5 ("abcdefghijklmnopqrstuvwxyz") == "c3fcd3d76192e4007dfb496cca67e13b");
        DLIB_TEST(md5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") == "d174ab98d277d9f5a5611c2c9f419d9f");
        DLIB_TEST(md5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") == "57edf4a22be3c955ac49da2e2107b67a");


    }


    class md5_tester : public tester
    {
    public:
        md5_tester (
        ) :
            tester ("test_md5",
                    "Runs tests on the md5 component.")
        {}

        void perform_test (
        )
        {
            md5_test();
        }
    } a;

}