Saturday, December 26, 2015

options for hash types

I started to write a better cracker that would support more hash types and give options. Here's some of the options.

#include <string>
#include <sstream>
#include <iostream>
#include <cctype>
#include <fstream>
#include "md5.h"
#include "sha1.h"
#include "sha224.h"
#include "sha256.h"
#include "sha384.h"
#include "sha512.h"
#include <algorithm>
using namespace std;

char* getCmdOption(char ** begin, char ** end, const std::string & option)
{
    char ** itr = std::find(begin, end, option);
    if (itr != end && ++itr != end)
    {
        return *itr;
    }
    return 0;
}

bool cmdOptionExists(char** begin, char** end, const std::string& option)
{
    return std::find(begin, end, option) != end;
}

int main(int argc, char * argv[])
{

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

if (infile.is_open())

{ while ( getline (infile,line) )

{

if(cmdOptionExists(argv, argv+argc, "-md5"))
    {
        cout << md5(line) << " " << line << endl;
    }
if(cmdOptionExists(argv, argv+argc, "-sha1"))
    {
    cout << sha1(line) << " " << line << endl;
    }
if(cmdOptionExists(argv, argv+argc, "-sha224"))
    {
        cout << sha224(line) << " " << line<< endl;
    }
if(cmdOptionExists(argv, argv+argc, "-sha256"))
    {
        cout << sha256(line) << " " << line << endl;
    }
if(cmdOptionExists(argv, argv+argc, "-sha384"))
    {
        cout << sha384(line) << " " << line<< endl;
    }
if(cmdOptionExists(argv, argv+argc, "-sha384"))
    {
        cout << sha384(line) << " " << line << endl;
    }
if(cmdOptionExists(argv, argv+argc, "-sha512"))
    {
        cout << sha512(line) << " " << line << endl;
    }
}
}
infile.close();


    }
return 0; }

No comments:

Post a Comment