forked from Bragegs/openssl-example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
examples.cpp
25 lines (18 loc) · 839 Bytes
/
examples.cpp
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
#include "crypto.hpp"
#include <iostream>
using namespace std;
int main() {
cout << "SHA-1 with 1 iteration" << endl;
cout << Crypto::hex(Crypto::sha1("Test")) << endl << endl;
cout << "SHA-1 with two iterations" << endl;
cout << Crypto::hex(Crypto::sha1(Crypto::sha1("Test"))) << endl;
cout << Crypto::hex(Crypto::sha1("Test", 2)) << endl << endl;
cout << "The derived key from the PBKDF2 algorithm" << endl;
cout << Crypto::hex(Crypto::pbkdf2("Password", "Salt")) << endl << endl;
cout << "MD5 with 1 iteration" << endl;
cout << Crypto::hex(Crypto::md5("Hey")) << endl << endl;
cout << "SHA256 with 1 iteration" << endl;
cout << Crypto::hex(Crypto::sha256("Tester")) << endl << endl;
cout << "SHA512 with 1 iteration" << endl;
cout << Crypto::hex(Crypto::sha512("Ole er kul")) << endl << endl;
}