-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhash_gen.cpp
More file actions
46 lines (37 loc) · 1.16 KB
/
hash_gen.cpp
File metadata and controls
46 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <string>
#include "hashlibpp.h"
#include "hl_hashwrapper.h"
using namespace std;
static const string version = "v0.1a";
int main(int argc, char* argv[]) {
// TODO : Add version info
// Add syntax // hash-gen [data] [md5/sha1]
string output;
string whitespace (" \t\f\v\n\r");
size_t found;
if(argc!=3){
cout << endl << "hashgen " << version << " by warl0k - http://psilocyb1n.net" << endl;
cout << endl << "Syntax:" << endl << "hash-gen [data] [md5/sha1]" << endl << endl;
return 0;
}
hashwrapper *md5 = new md5wrapper();
hashwrapper *sha1 = new sha1wrapper();
string lino = argv[2];
found = lino.find_last_not_of(whitespace);
if (found!=string::npos){
lino.erase(found+1);
}else{
lino.clear();
}
cout << "Data: " << argv[1] << " - Type: " << argv[2] << endl;
if(lino.compare("md5") == 0){
output = md5->getHashFromString(argv[1]);
}else{
output = sha1->getHashFromString(argv[1]);
}
cout << "Hash: " << output << endl;
return 0;
}