63 lines
2.5 KiB
C++
63 lines
2.5 KiB
C++
|
#include <iostream>
|
||
|
#include <src/Identity.h>
|
||
|
#include <sstream>
|
||
|
#include "HideString.h"
|
||
|
DEFINE_HIDDEN_STRING(HeaderMessage, 0x44, ('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')(' ')('T')('S')('3')(' ')('H')('a')('s')('h')(' ')('b')('y')(' ')('W')('o')('l')('v')('e')('r')('i')('n')('D')('E')('V')(' ')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#')('#'));
|
||
|
|
||
|
using namespace ts;
|
||
|
using namespace std;
|
||
|
|
||
|
inline string crypt(string in){
|
||
|
stringstream result;
|
||
|
result << "DEFINE_HIDDEN_STRING(EncryptionKey, 0xA5, ";
|
||
|
|
||
|
for(char c : in)
|
||
|
result << "('" << c << "')";
|
||
|
|
||
|
result << ");";
|
||
|
return result.str();
|
||
|
}
|
||
|
|
||
|
int main(int argc, char** argv) {
|
||
|
cout << GetHeaderMessage() << endl;
|
||
|
if(argc < 3) {
|
||
|
cerr << "Invalid arguments. ./TSHash <threads> <MaxLevel> [<BlockSize> = 1.000.000]" << endl;
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
init_LTM();
|
||
|
if(register_prng(&sprng_desc) == -1) {
|
||
|
cerr << "could not setup prng" << endl;
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
if (register_cipher(&rijndael_desc) == -1) {
|
||
|
cerr << "could not setup rijndael" << endl;
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
|
||
|
int threads = atoi(argv[1]);
|
||
|
int level = atoi(argv[2]);
|
||
|
int blockSize = argc > 3 ? atoi(argv[3]) : 1 * 1000 * 1000;
|
||
|
|
||
|
cout << "# Creating new identity (Threads: " << threads << " Level: " << level << " Size: " << blockSize << ")" << endl;
|
||
|
auto identity = Identity::createNew();
|
||
|
cout << "IDENTITY: " << identity->exportIdentity() << endl;
|
||
|
cout << "# Start hashing" << endl;
|
||
|
if(!identity->improveSecurityLevelMultithreaded(level, threads, blockSize, 0, true)) {
|
||
|
cout << "ERROR: Could not improve identity!" << endl;
|
||
|
return 1;
|
||
|
}
|
||
|
cout << "INFO: Found identity!" << endl;
|
||
|
cout << "IDENTITY: " << identity->exportIdentity() << endl;
|
||
|
cout << "LEVEL: " << identity->getSecurityLevel() << endl;
|
||
|
return 0;
|
||
|
}
|
||
|
/*
|
||
|
#IDENTITY: 5513931022VPXfjXSN1qRa2IZvTpS3xs+L7YvcBI2lTfXgOWAkaAQwQVgR8BXtWJ1MKUSh/HGNGNgdVGWYHcCg1BgQie3pValZZB39hVE4HBStcAA5SUz9Tf1JbXVABBVUJUwFmFkJZLlZUfCtaZXFBaUVBZ1poOXlQd09KSzN6ejYxMjVnaGN3bmtSKzRPOXdvZWJObVpaT3gyOTA3ND0=
|
||
|
#LEVEL: 36
|
||
|
|
||
|
#IDENTITY: 0VdYzXyIWNlPR991zQZLQoGLDYA4JvCX9GQ3MAYzpBRABWAHZTAmJvNQUAMxEEKGQDJVlnanF1YDdQQn0GewlXVWoAQmVMLX9FVyZaMAI7KlAIeXpPKGMCJ3BTVAJHLGlUHARbBlpqSUNJUURISXY1UXJCYmlBMHlZOVV3dFdRRXovM0lkU1hzNFJvWTkwT1JienA5bVRRPT0=
|
||
|
Current level = 41 at 1233527956186
|
||
|
Current offset index: 3750576000000 block size: 1000000
|
||
|
|
||
|
*/
|