Implement of :
Sha1 Sha224 Sha384 Sha256 Sha512 and some minor fix
This commit is contained in:
@@ -17,7 +17,7 @@ set(SOURCE_FILES
|
|||||||
src/RH_Utils.cpp
|
src/RH_Utils.cpp
|
||||||
RH_Main.cpp
|
RH_Main.cpp
|
||||||
COPYING
|
COPYING
|
||||||
README
|
README.md
|
||||||
)
|
)
|
||||||
#Ajout de openssl
|
#Ajout de openssl
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
@@ -36,4 +36,4 @@ link_libraries(${CMAKE_THREAD_LIBS_INIT})
|
|||||||
#find_package(Crypto REQUIRED)
|
#find_package(Crypto REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
add_executable(testPassV8 ${SOURCE_FILES})
|
add_executable(rizzlehash ${SOURCE_FILES})
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "include/RH_App.h"
|
|
||||||
#include "include/RH_GUI.h"
|
#include "include/RH_GUI.h"
|
||||||
#include "include/RH_ProcessBruteForce.h"
|
#include "include/RH_ProcessBruteForce.h"
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ class RH_Encryption
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RH_Encryption();
|
RH_Encryption();
|
||||||
|
static function<string (string)> getFunctionHashLambda(string hashMethode);
|
||||||
|
//static function<string (string)> hashForLambda(function<string(string)> functionLambda, string value);
|
||||||
|
virtual ~RH_Encryption();
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
static function<string (string)> none();
|
static function<string (string)> none();
|
||||||
static function<string (string)> md5();
|
static function<string (string)> md5();
|
||||||
static function<string (string)> sha1();
|
static function<string (string)> sha1();
|
||||||
@@ -24,10 +29,7 @@ class RH_Encryption
|
|||||||
static function<string (string)> sha384();
|
static function<string (string)> sha384();
|
||||||
static function<string (string)> sha256();
|
static function<string (string)> sha256();
|
||||||
static function<string (string)> sha512();
|
static function<string (string)> sha512();
|
||||||
//static function<string (string)> hashForLambda(function<string(string)> functionLambda, string value);
|
static string bytesArrayToStrinctString(uint8_t, unsigned char*);
|
||||||
virtual ~RH_Encryption();
|
|
||||||
protected:
|
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RH_ENCRYPTION_H
|
#endif // RH_ENCRYPTION_H
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class ProcessBruteForce
|
|||||||
void operator()();
|
void operator()();
|
||||||
virtual ~ProcessBruteForce();
|
virtual ~ProcessBruteForce();
|
||||||
private:
|
private:
|
||||||
function<string(string)> getFunctionHash(string hashMethode);
|
|
||||||
void bruteForce();
|
void bruteForce();
|
||||||
void recursiveFunction(uint32_t index);
|
void recursiveFunction(uint32_t index);
|
||||||
void testSpeed(string currentWord);
|
void testSpeed(string currentWord);
|
||||||
|
|||||||
@@ -23,52 +23,60 @@ RH_Encryption::RH_Encryption(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function<string (string)> RH_Encryption::md5(){
|
function<string (string)> RH_Encryption::md5(){
|
||||||
|
function<string (string)> methode = [] (string value){
|
||||||
return [] (string value){
|
const unsigned char* stringValue = (unsigned char *) value.c_str();
|
||||||
const char* stringValue = value.c_str();
|
|
||||||
MD5_CTX md5;
|
MD5_CTX md5;
|
||||||
MD5_Init(&md5);
|
MD5_Init(&md5);
|
||||||
MD5_Update(&md5,(const unsigned char*)stringValue, value.length());
|
MD5_Update(&md5,(const unsigned char*)stringValue, value.length());
|
||||||
unsigned char buffer[16];
|
unsigned char buffer[MD5_DIGEST_LENGTH];
|
||||||
MD5_Final(buffer, &md5);
|
MD5_Final(buffer, &md5);
|
||||||
char mdString[32];
|
return bytesArrayToStrinctString(MD5_DIGEST_LENGTH,buffer);
|
||||||
string result;
|
|
||||||
|
|
||||||
for (uint16_t i = 0; i < 16; i++) {
|
|
||||||
sprintf(mdString, "%02x", buffer[i]);
|
|
||||||
result.append(mdString);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
};
|
||||||
|
return methode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function<string (string)> RH_Encryption::sha1(){
|
function<string (string)> RH_Encryption::sha1(){
|
||||||
return [](string value){
|
return [](string value){
|
||||||
return value;
|
const unsigned char* stringValue = (unsigned char *) value.c_str();
|
||||||
|
unsigned char buffer[SHA_DIGEST_LENGTH];
|
||||||
|
SHA(stringValue,value.length(),buffer);
|
||||||
|
return bytesArrayToStrinctString(SHA_DIGEST_LENGTH,buffer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function<string (string)> RH_Encryption::sha224(){
|
function<string (string)> RH_Encryption::sha224(){
|
||||||
return [](string value){
|
return [](string value){
|
||||||
return value;
|
const unsigned char* stringValue = (unsigned char *) value.c_str();
|
||||||
|
unsigned char buffer[SHA224_DIGEST_LENGTH];
|
||||||
|
SHA224(stringValue,value.length(),buffer);
|
||||||
|
return bytesArrayToStrinctString(SHA224_DIGEST_LENGTH,buffer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function<string (string)> RH_Encryption::sha384(){
|
function<string (string)> RH_Encryption::sha384(){
|
||||||
return [](string value){
|
return [](string value){
|
||||||
return value;
|
const unsigned char* stringValue = (unsigned char *) value.c_str();
|
||||||
|
unsigned char buffer[SHA384_DIGEST_LENGTH];
|
||||||
|
SHA384(stringValue,value.length(),buffer);
|
||||||
|
return bytesArrayToStrinctString(SHA384_DIGEST_LENGTH,buffer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function<string (string)> RH_Encryption::sha256(){
|
function<string (string)> RH_Encryption::sha256(){
|
||||||
return [](string value){
|
return [](string value){
|
||||||
return value;
|
const unsigned char* stringValue = (unsigned char *) value.c_str();
|
||||||
|
unsigned char buffer[SHA256_DIGEST_LENGTH];
|
||||||
|
SHA256(stringValue,value.length(),buffer);
|
||||||
|
return bytesArrayToStrinctString(SHA256_DIGEST_LENGTH,buffer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function<string (string)> RH_Encryption::sha512( ){
|
function<string (string)> RH_Encryption::sha512( ){
|
||||||
return [](string value){
|
return [](string value){
|
||||||
return value;
|
const unsigned char* stringValue = (unsigned char *) value.c_str();
|
||||||
|
unsigned char buffer[SHA512_DIGEST_LENGTH];
|
||||||
|
SHA256(stringValue,value.length(),buffer);
|
||||||
|
return bytesArrayToStrinctString(SHA512_DIGEST_LENGTH,buffer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,10 +86,34 @@ function<string (string)> RH_Encryption::none(){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function<string(string)> RH_Encryption::getFunctionHashLambda(string hashMethode) {
|
||||||
|
function<string(string)> resultMethode;
|
||||||
|
|
||||||
|
if (hashMethode == "md5") resultMethode = md5();
|
||||||
|
else if(hashMethode == "sha1") resultMethode = sha1();
|
||||||
|
else if(hashMethode == "sha224") resultMethode = sha224();
|
||||||
|
else if(hashMethode == "sha384") resultMethode = sha384();
|
||||||
|
else if(hashMethode == "sha256") resultMethode = sha256();
|
||||||
|
else if(hashMethode == "sha512") resultMethode = sha512();
|
||||||
|
else resultMethode = none();
|
||||||
|
|
||||||
|
return resultMethode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*function<string (string)> RH_Encryption::hashForLambda(function<string(string)> functionLambda, string value){
|
/*function<string (string)> RH_Encryption::hashForLambda(function<string(string)> functionLambda, string value){
|
||||||
return functionLambda(value);
|
return functionLambda(value);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
string RH_Encryption::bytesArrayToStrinctString(uint8_t lenght, unsigned char * bytes) {
|
||||||
|
char resString[2];
|
||||||
|
string result;
|
||||||
|
for (uint8_t i = 0; i < lenght; i++){
|
||||||
|
sprintf(resString,"%02x", bytes[i]);
|
||||||
|
result.append(resString);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RH_Encryption::~RH_Encryption(){
|
RH_Encryption::~RH_Encryption(){
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright <EFBFBD> 2015 Matthieu DUVAL, Rudy DUCHE
|
* Copyright © 2015 Matthieu DUVAL, Rudy DUCHE
|
||||||
*
|
*
|
||||||
* This file is part of RizzleHash.
|
* This file is part of RizzleHash.
|
||||||
*
|
*
|
||||||
@@ -36,7 +36,7 @@ void ProcessBruteForce::init(queue<statReturn> * q,int idx,int nbInstence,string
|
|||||||
this->idx = idx;
|
this->idx = idx;
|
||||||
this->nbInstence = nbInstence;
|
this->nbInstence = nbInstence;
|
||||||
this->hashString = hashString;
|
this->hashString = hashString;
|
||||||
this->hashMethodeFunction = this->getFunctionHash(hashMethode);
|
this->hashMethodeFunction = RH_Encryption::getFunctionHashLambda(hashMethode);
|
||||||
this->clef = clef;
|
this->clef = clef;
|
||||||
this->limite = limite;
|
this->limite = limite;
|
||||||
this->verbose = verbose;
|
this->verbose = verbose;
|
||||||
@@ -51,14 +51,6 @@ void ProcessBruteForce::init(queue<statReturn> * q,int idx,int nbInstence,string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function<string(string)> ProcessBruteForce::getFunctionHash(string hashMethode){
|
|
||||||
if(hashMethode == "md5"){
|
|
||||||
return RH_Encryption::md5();
|
|
||||||
}else{
|
|
||||||
return RH_Encryption::none();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessBruteForce::operator()()
|
void ProcessBruteForce::operator()()
|
||||||
{
|
{
|
||||||
this->clock = time(NULL);// on initialise la clock locale
|
this->clock = time(NULL);// on initialise la clock locale
|
||||||
|
|||||||
Reference in New Issue
Block a user