5 #include "ciphers/md4hash.h"
8 test_md4hash(gchar
*data
, gchar
*digest
) {
9 PurpleHash
*hash
= NULL
;
13 hash
= purple_md4_hash_new();
15 purple_hash_append(hash
, (guchar
*)data
, strlen(data
));
17 ret
= purple_hash_digest_to_str(hash
, cdigest
, sizeof(cdigest
));
20 g_assert_cmpstr(digest
, ==, cdigest
);
24 test_md4hash_empty_string(void) {
26 "31d6cfe0d16ae931b73c59d7e0c089c0");
30 test_md4hash_a(void) {
32 "bde52cb31de33e46245e05fbdbd6fb24");
36 test_md4hash_abc(void) {
38 "a448017aaf21d8525fc10ae87aa6729d");
42 test_md4hash_message_digest(void) {
43 test_md4hash("message digest",
44 "d9130a8164549fe818874806e1c7014b");
48 test_md4hash_a_to_z(void) {
49 test_md4hash("abcdefghijklmnopqrstuvwxyz",
50 "d79e1c308aa5bbcdeea8ed63df412da9");
54 test_md4hash_A_to_Z_a_to_z_0_to_9(void) {
55 test_md4hash("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
56 "043f8582f241db351ce627e153e7f0e4");
60 test_md4hash_1_to_0_eight_times(void) {
61 test_md4hash("12345678901234567890123456789012345678901234567890123456789012345678901234567890",
62 "e33b4ddc9c38f2199c3e7b164fcc0536");
66 main(gint argc
, gchar
**argv
) {
67 g_test_init(&argc
, &argv
, NULL
);
69 g_test_add_func("/hash/md4/empty-string",
70 test_md4hash_empty_string
);
71 g_test_add_func("/hash/md4/a",
73 g_test_add_func("/hash/md4/abc",
75 g_test_add_func("/hash/md4/message digest",
76 test_md4hash_message_digest
);
77 g_test_add_func("/hash/md4/a to z",
79 g_test_add_func("/hash/md4/A to Z, a to z, 0 to 9" ,
80 test_md4hash_A_to_Z_a_to_z_0_to_9
);
81 g_test_add_func("/hash/md4/1 to 0 eight times",
82 test_md4hash_1_to_0_eight_times
);