@@ -18,9 +18,11 @@ namespace SimpleWeb {
1818 }
1919 #endif
2020
21- namespace Crypto {
22- namespace Base64 {
23- std::string encode (const std::string &ascii) {
21+ class Crypto {
22+ public:
23+ class Base64 {
24+ public:
25+ static std::string encode (const std::string &ascii) {
2426 std::string base64;
2527
2628 BIO *bio, *b64;
@@ -52,7 +54,7 @@ namespace SimpleWeb {
5254 return base64;
5355 }
5456
55- std::string decode (const std::string &base64) {
57+ static std::string decode (const std::string &base64) {
5658 std::string ascii;
5759
5860 // Resize ascii, however, the size is a up to two bytes too large.
@@ -71,9 +73,9 @@ namespace SimpleWeb {
7173
7274 return ascii;
7375 }
74- }
76+ };
7577
76- std::string MD5 (const std::string &input, size_t iterations=1 ) {
78+ static std::string MD5 (const std::string &input, size_t iterations=1 ) {
7779 std::string hash;
7880
7981 hash.resize (128 / 8 );
@@ -85,7 +87,7 @@ namespace SimpleWeb {
8587 return hash;
8688 }
8789
88- std::string SHA1 (const std::string &input, size_t iterations=1 ) {
90+ static std::string SHA1 (const std::string &input, size_t iterations=1 ) {
8991 std::string hash;
9092
9193 hash.resize (160 / 8 );
@@ -97,7 +99,7 @@ namespace SimpleWeb {
9799 return hash;
98100 }
99101
100- std::string SHA256 (const std::string &input, size_t iterations=1 ) {
102+ static std::string SHA256 (const std::string &input, size_t iterations=1 ) {
101103 std::string hash;
102104
103105 hash.resize (256 / 8 );
@@ -109,7 +111,7 @@ namespace SimpleWeb {
109111 return hash;
110112 }
111113
112- std::string SHA512 (const std::string &input, size_t iterations=1 ) {
114+ static std::string SHA512 (const std::string &input, size_t iterations=1 ) {
113115 std::string hash;
114116
115117 hash.resize (512 / 8 );
@@ -120,7 +122,7 @@ namespace SimpleWeb {
120122
121123 return hash;
122124 }
123- }
125+ };
124126}
125127#endif /* CRYPTO_HPP */
126128
0 commit comments