Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoreidheim <eidheim@gmail.com>2016-12-20 17:50:56 +0300
committereidheim <eidheim@gmail.com>2016-12-20 17:52:22 +0300
commit24adf914a34325528a17fce1cadff95b06e80617 (patch)
treefb45e0d3febac68d93f151071f61f83552047224 /tests
parentb957bdd68594f2d936592b25b7059b3e2c77f2cd (diff)
Renamed Crypto:: hash methods
Diffstat (limited to 'tests')
-rw-r--r--tests/crypto_test.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/crypto_test.cpp b/tests/crypto_test.cpp
index 22a84a6..9ea9c2e 100644
--- a/tests/crypto_test.cpp
+++ b/tests/crypto_test.cpp
@@ -9,7 +9,7 @@
using namespace std;
using namespace SimpleWeb;
-const vector<pair<string, string> > Base64_string_tests = {
+const vector<pair<string, string> > base64_string_tests = {
{"", ""},
{"f" , "Zg=="},
{"fo", "Zm8="},
@@ -19,50 +19,50 @@ const vector<pair<string, string> > Base64_string_tests = {
{"foobar", "Zm9vYmFy"}
};
-const vector<pair<string, string> > MD5_string_tests = {
+const vector<pair<string, string> > md5_string_tests = {
{"", "d41d8cd98f00b204e9800998ecf8427e"},
{"The quick brown fox jumps over the lazy dog", "9e107d9d372bb6826bd81d3542a419d6"}
};
-const vector<pair<string, string> > SHA1_string_tests = {
+const vector<pair<string, string> > sha1_string_tests = {
{"", "da39a3ee5e6b4b0d3255bfef95601890afd80709"},
{"The quick brown fox jumps over the lazy dog", "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"}
};
-const vector<pair<string, string> > SHA256_string_tests = {
+const vector<pair<string, string> > sha256_string_tests = {
{"", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
{"The quick brown fox jumps over the lazy dog", "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592"}
};
-const vector<pair<string, string> > SHA512_string_tests = {
+const vector<pair<string, string> > sha512_string_tests = {
{"", "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"},
{"The quick brown fox jumps over the lazy dog", "07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6"}
};
int main() {
//Testing SimpleWeb::Crypt::Base64
- for(auto& string_test: Base64_string_tests) {
+ for(auto& string_test: base64_string_tests) {
assert(Crypto::Base64::encode(string_test.first)==string_test.second);
assert(Crypto::Base64::decode(string_test.second)==string_test.first);
}
//Testing SimpleWeb::Crypt::MD5
- for(auto& string_test: MD5_string_tests)
- assert(Crypto::to_hex_string(Crypto::MD5(string_test.first)) == string_test.second);
+ for(auto& string_test: md5_string_tests)
+ assert(Crypto::to_hex_string(Crypto::md5(string_test.first)) == string_test.second);
- //Testing SimpleWeb::Crypt::SHA1
- for(auto& string_test: SHA1_string_tests)
- assert(Crypto::to_hex_string(Crypto::SHA1(string_test.first)) == string_test.second);
+ //Testing SimpleWeb::Crypt::sha1
+ for(auto& string_test: sha1_string_tests)
+ assert(Crypto::to_hex_string(Crypto::sha1(string_test.first)) == string_test.second);
- //Testing SimpleWeb::Crypt::SHA256
- for(auto& string_test: SHA256_string_tests)
- assert(Crypto::to_hex_string(Crypto::SHA256(string_test.first)) == string_test.second);
+ //Testing SimpleWeb::Crypt::sha256
+ for(auto& string_test: sha256_string_tests)
+ assert(Crypto::to_hex_string(Crypto::sha256(string_test.first)) == string_test.second);
- //Testing SimpleWeb::Crypt::SHA512
- for(auto& string_test: SHA512_string_tests)
- assert(Crypto::to_hex_string(Crypto::SHA512(string_test.first)) == string_test.second);
+ //Testing SimpleWeb::Crypt::sha512
+ for(auto& string_test: sha512_string_tests)
+ assert(Crypto::to_hex_string(Crypto::sha512(string_test.first)) == string_test.second);
//Testing iterations
- assert(Crypto::to_hex_string(Crypto::SHA1("Test", 1)) == "640ab2bae07bedc4c163f679a746f7ab7fb5d1fa");
- assert(Crypto::to_hex_string(Crypto::SHA1("Test", 2)) == "af31c6cbdecd88726d0a9b3798c71ef41f1624d5");
+ assert(Crypto::to_hex_string(Crypto::sha1("Test", 1)) == "640ab2bae07bedc4c163f679a746f7ab7fb5d1fa");
+ assert(Crypto::to_hex_string(Crypto::sha1("Test", 2)) == "af31c6cbdecd88726d0a9b3798c71ef41f1624d5");
}