''' #include <openssl/md5.h>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
void printMD5_tostream(std::ostream &os, unsigned char *md,
long size = MD5_DIGEST_LENGTH) {
for (int i = 0; i < size; i++) {
os << std::hex << std::setw(2) << std::setfill('0') << (int)md[i];
}
}
std::string cal_pincode_md5(char *pincode) {
unsigned char md5_result[MD5_DIGEST_LENGTH];
MD5(reinterpret_cast<unsigned char *>(pincode),
strlen(const_cast<const char *>(pincode)), md5_result);
std::stringstream mysstream;
printMD5_tostream(mysstream, md5_result);
return mysstream.str();
}
int main(int argc, char **argv) {
if (argc != 2) {
std::cout << "You must input an string value as the argument";
return -1;
};
auto givenvalue = argv[1];
std::string myhash{"5d41402abc4b2a76b9719d911017c592"};
std::cout << cal_pincode_md5(givenvalue) << std::endl;
std::cout << (myhash == cal_pincode_md5(givenvalue)) << std::endl;
}
'''