added checksum verification

This commit is contained in:
Aéna Aria 2026-02-26 11:55:27 +01:00
parent 649b9af022
commit 746babc772

View file

@ -1,5 +1,6 @@
#pragma clang diagnostic ignored "-Wwritable-strings"
#include "stdafx.h" // IWYU pragma: keep
#include <climits>
#pragma clang diagnostic ignored "-Wwritable-strings"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@ -450,6 +451,9 @@ typedef struct {
void fake_exit(char* msg){
printf("%s\n",msg);
for (int i = 0; i < INT_MAX; i++) {
printf("");
}
exit(0);
}
@ -467,8 +471,10 @@ bool verif_checksum_prog(){
long size = end-start;
unsigned char hash [32];
lonesha256(hash, start, size);
print_hash(hash);
return memcmp(hash, hash, 32) == 0;
// print_hash(hash);
unsigned char compareto [32] = {0xeb, 0x4c, 0x4, 0xd0, 0xb7, 0xd6, 0x8f, 0x16, 0x1, 0x66, 0xb8, 0x6d, 0x4b, 0x13
, 0x7b, 0x94, 0xae, 0x70, 0x51, 0xb6, 0xda, 0x7, 0xae, 0xcf, 0xd3, 0x38, 0x4f, 0xf, 0x48, 0x22, 0x45, 0x55};
return memcmp(hash, compareto, 32) == 0;
}
@ -483,10 +489,11 @@ int main(int argc, char *argv[]) {
unsigned char h1[32], h2[32], h_leurre[32];
uint64_t mask = 0;
bool valid = verif_checksum_prog();
if(!valid){
fake_exit(argv[1]);
}
// TODO: UNCOMMENT THIS BEFORE SENDING AND VERIFY CHECKSUM!!!!!!!!!!!!!!!!!!!!!!!!!!
// bool valid = verif_checksum_prog();
// if(!valid){
// fake_exit(argv[1]);
// }
while (selector != M_EXIT) {
switch (selector) {