Saturday, December 26, 2015

SHA512 plaintext pairs

So say you want to make a lookup table for SHA512 hashes. Maybe you want to load it into a MySQL database or create plaintext hash pair lookup cards. Here's an easy way to do that. I wrote bunch of programs that do this kind of stuff. When I was looking for a faster way to look up plaintexts.

You can find the SHA512 C++ files here.
/reads a text file and ouputs plaintext hash pairs to a new file
#include <string>
#include <sstream>
#include <iostream>
#include <cctype>
#include <fstream>
#include "sha512.h"
using namespace std;

int main (int argc, char* argv[])
{
cout << "creating" << argv[2] << endl;
{ofstream myfile;
myfile.open (argv[2]);

{ string line; ifstream infile (argv[1]);

if (infile.is_open())
{

{ while ( getline (infile,line) )
{
myfile << sha512(line) << endl;
myfile << line << endl;
}


infile.close();
}

}
 else cout << "Unable to open file" << endl;

cout << argv[2] << " complete" << endl;
}
}
return 0; }

No comments:

Post a Comment