firstCrypt.cpp

URL: https://mirkwood.cs.edinboro.edu/~bennett/class/cmac2000/spring2026/notes/two/code/firstCrypt.cpp
 
#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");

     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;
}