-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuzzypp.cpp
37 lines (30 loc) · 824 Bytes
/
fuzzypp.cpp
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
#include <iostream>
#include <fstream>
#include <vector>
#include <memory>
#include "FuzzyConstants.h"
#include "FuzzyHashMode.h"
#include "Hasher.h"
using namespace std;
using namespace FuzzyPP;
int main(int argc, char *argv[]) {
if (argc < 2) {
printf("Usage:\n\t%s [path to file]\n", argv[0]);
return -1;
}
std::ifstream f(argv[1], std::ios::binary);
if (!f.is_open()) {
printf("Cannot open file %s\n", argv[1]);
return -1;
}
f.seekg(0, std::ios::end);
auto size = f.tellg();
f.seekg(0, std::ios::beg);
std::vector<unsigned char> data(size);
f.read((char*)&data[0], size);
f.close();
//auto hasher = new Hasher();
auto h = Hasher::HashBuffer(data.data(), data.size());
printf("%s = %s\n", argv[1], h.c_str());
return 0;
}