#include <iostream> #include <unistd.h> using namespace std; void DoCrypt(string passwd, string salt); int main() { DoCrypt("Hello", "ab"); DoCrypt("Hello", "ab"); DoCrypt("Hello", "ac"); DoCrypt("hello", "ab"); DoCrypt("hellO", "ab"); DoCrypt("hello", "$1$abcdefghijklmnop$"); DoCrypt("hello", "$6$abcdefghijklmnop$"); DoCrypt("hello", "$6$rounds=5000$abcdefghijklmnop$"); DoCrypt("hello", "$6$rounds=5001$abcdefghijklmnop$"); DoCrypt("hello", "$6$rounds=7000$abcdefghijklmnop$"); return 0; } void DoCrypt(string passwd, string salt){ string hash; hash = crypt(passwd.c_str(), salt.c_str()); cout << '"' << passwd << "\" along with \"" << salt << "\" crypts to \"" << hash << '"' << endl; cout << endl; }