Mercurial > pidgin
comparison plugins/ciphertest.c @ 10687:b256ce6b85b8
[gaim-migrate @ 12235]
grim says this is really fixed this time.
committer: Tailor Script <tailor@pidgin.im>
| author | Etan Reisner <pidgin@unreliablesource.net> |
|---|---|
| date | Sat, 12 Mar 2005 01:10:37 +0000 |
| parents | 72a5babfa8b4 |
| children | 50224ac8184d |
comparison
equal
deleted
inserted
replaced
| 10686:212946f774c0 | 10687:b256ce6b85b8 |
|---|---|
| 63 static void | 63 static void |
| 64 cipher_test_md5() { | 64 cipher_test_md5() { |
| 65 GaimCipher *cipher; | 65 GaimCipher *cipher; |
| 66 GaimCipherContext *context; | 66 GaimCipherContext *context; |
| 67 gchar digest[32]; | 67 gchar digest[32]; |
| 68 gboolean ret; | |
| 68 gint i = 0; | 69 gint i = 0; |
| 69 | 70 |
| 70 cipher = gaim_ciphers_find_cipher("md5"); | 71 cipher = gaim_ciphers_find_cipher("md5"); |
| 71 if(!cipher) { | 72 if(!cipher) { |
| 72 gaim_debug_info("cipher-test", | 73 gaim_debug_info("cipher-test", |
| 83 gaim_debug_info("cipher-test", "Testing '%s'\n", md5_tests[i].question); | 84 gaim_debug_info("cipher-test", "Testing '%s'\n", md5_tests[i].question); |
| 84 | 85 |
| 85 gaim_cipher_context_append(context, md5_tests[i].question, | 86 gaim_cipher_context_append(context, md5_tests[i].question, |
| 86 strlen(md5_tests[i].question)); | 87 strlen(md5_tests[i].question)); |
| 87 | 88 |
| 88 gaim_cipher_context_digest_to_str(context, NULL, digest); | 89 ret = gaim_cipher_context_digest_to_str(context, sizeof(digest), |
| 89 | 90 digest, NULL); |
| 90 gaim_debug_info("cipher-test", "\tGot: %s\n", digest); | 91 |
| 91 gaim_debug_info("cipher-test", "\tWanted: %s\n", md5_tests[i].answer); | 92 if(!ret) { |
| 93 gaim_debug_info("cipher-test", "failed\n"); | |
| 94 } else { | |
| 95 gaim_debug_info("cipher-test", "\tGot: %s\n", digest); | |
| 96 gaim_debug_info("cipher-test", "\tWanted: %s\n", | |
| 97 md5_tests[i].answer); | |
| 98 } | |
| 92 | 99 |
| 93 gaim_cipher_context_reset(context, NULL); | 100 gaim_cipher_context_reset(context, NULL); |
| 94 i++; | 101 i++; |
| 95 } | 102 } |
| 96 | 103 |
| 114 cipher_test_sha1() { | 121 cipher_test_sha1() { |
| 115 GaimCipher *cipher; | 122 GaimCipher *cipher; |
| 116 GaimCipherContext *context; | 123 GaimCipherContext *context; |
| 117 gchar digest[40]; | 124 gchar digest[40]; |
| 118 gint i = 0; | 125 gint i = 0; |
| 126 gboolean ret; | |
| 119 | 127 |
| 120 cipher = gaim_ciphers_find_cipher("sha1"); | 128 cipher = gaim_ciphers_find_cipher("sha1"); |
| 121 if(!cipher) { | 129 if(!cipher) { |
| 122 gaim_debug_info("cipher-test", | 130 gaim_debug_info("cipher-test", |
| 123 "could not find sha1 cipher, not testing\n"); | 131 "could not find sha1 cipher, not testing\n"); |
| 145 | 153 |
| 146 for(j = 0; j < 1000; j++) | 154 for(j = 0; j < 1000; j++) |
| 147 gaim_cipher_context_append(context, buff, 1000); | 155 gaim_cipher_context_append(context, buff, 1000); |
| 148 } | 156 } |
| 149 | 157 |
| 150 gaim_cipher_context_digest_to_str(context, NULL, digest); | 158 ret = gaim_cipher_context_digest_to_str(context, sizeof(digest), |
| 151 | 159 digest, NULL); |
| 152 gaim_debug_info("cipher-test", "\tGot: %s\n", digest); | 160 |
| 153 gaim_debug_info("cipher-test", "\tWanted: %s\n", sha1_tests[i].answer); | 161 if(!ret) { |
| 162 gaim_debug_info("cipher-test", "failed\n"); | |
| 163 } else { | |
| 164 gaim_debug_info("cipher-test", "\tGot: %s\n", digest); | |
| 165 gaim_debug_info("cipher-test", "\tWanted: %s\n", | |
| 166 sha1_tests[i].answer); | |
| 167 } | |
| 154 | 168 |
| 155 gaim_cipher_context_reset(context, NULL); | 169 gaim_cipher_context_reset(context, NULL); |
| 156 i++; | 170 i++; |
| 157 } | 171 } |
| 158 | 172 |
