Removing dusty comments
This commit is contained in:
parent
77ec404de6
commit
2aaa1e7a66
@ -7,9 +7,9 @@
|
|||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
void welcome(){
|
void welcome(){
|
||||||
print_info("----------------------------------------");
|
print_info("----------------------------------------------------------------------");
|
||||||
print_info(" 大字报");
|
print_info(" 大 字 报");
|
||||||
print_info("----------------------------------------");
|
print_info("-----------------------------------------------------------------------");
|
||||||
print_info(">> To write a message, just write it to the terminal and press enter.");
|
print_info(">> To write a message, just write it to the terminal and press enter.");
|
||||||
print_info(">> To show all messages, just press enter without writing anything.");
|
print_info(">> To show all messages, just press enter without writing anything.");
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ void print_info(char * msg) {
|
|||||||
|
|
||||||
void print_debug(char * msg){
|
void print_debug(char * msg){
|
||||||
if (DEBUG_LEVEL > 0) {
|
if (DEBUG_LEVEL > 0) {
|
||||||
printf("\x1b[31m[DEBUG]\x1b[0m %s \n", msg);
|
printf("\x1b[31m[DEBUG]\x1b[0m %s\n", msg);
|
||||||
}
|
}
|
||||||
if (DEBUG_LEVEL > 9) {
|
if (DEBUG_LEVEL > 9) {
|
||||||
getchar();
|
getchar();
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG_LEVEL 7
|
#define DEBUG_LEVEL 7
|
||||||
|
|
||||||
void welcome();
|
void welcome();
|
||||||
|
32
src/hash.c
32
src/hash.c
@ -3,13 +3,6 @@
|
|||||||
|
|
||||||
// Hash a single data
|
// Hash a single data
|
||||||
void hash_data(pub_data *data, unsigned char *buf) {
|
void hash_data(pub_data *data, unsigned char *buf) {
|
||||||
/*
|
|
||||||
data->length = 52 - 26;
|
|
||||||
data->id = 34538;
|
|
||||||
data->seqno = 4864;
|
|
||||||
data->data = "Luke, je suis ton \"pair\" !";
|
|
||||||
printf("Hash received: 9ffe841a99776f6d1295ac75b53a58d7\n");
|
|
||||||
*/
|
|
||||||
|
|
||||||
// All three fields are concatenated into a single buffer
|
// All three fields are concatenated into a single buffer
|
||||||
int totlen = data->length + 10;
|
int totlen = data->length + 10;
|
||||||
@ -27,13 +20,6 @@ void hash_data(pub_data *data, unsigned char *buf) {
|
|||||||
// Put truncated hash into buf
|
// Put truncated hash into buf
|
||||||
hash_trunc(hash, buf);
|
hash_trunc(hash, buf);
|
||||||
|
|
||||||
/*
|
|
||||||
printf("Hash built: ");
|
|
||||||
for(int i = 0; i < 16; i++) {
|
|
||||||
printf("%02x", buf[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash every data contained in data_list then return a network hash
|
// Hash every data contained in data_list then return a network hash
|
||||||
@ -90,24 +76,6 @@ void concat_data(pub_data *data, unsigned char *buf) {
|
|||||||
if (memcpy(buf+10, data->data, data->length) == NULL) {
|
if (memcpy(buf+10, data->data, data->length) == NULL) {
|
||||||
print_debug(">> Contact the data (data) didn't work !");
|
print_debug(">> Contact the data (data) didn't work !");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
uint64_t *id = (uint64_t *) buf;
|
|
||||||
uint16_t *seqno2 = (uint16_t *) (buf + 8);
|
|
||||||
char *message = (char*) (buf + 10);
|
|
||||||
char fuck[100];
|
|
||||||
|
|
||||||
printf("id: %ld\nseqno: %d\nmessage: ", *id, *seqno2);
|
|
||||||
for(int i = 0; i < data->length; i++) {
|
|
||||||
printf("%c", message[i]);
|
|
||||||
}
|
|
||||||
printf("\nORIGINAL\n");
|
|
||||||
printf("id: %ld\nseqno: %d\nmessage: ", data->id, htobe16(data->seqno));
|
|
||||||
for(int i = 0; i < data->length; i++) {
|
|
||||||
printf("%c", data->data[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concat hash2 to hash1 (hash1 is modified)
|
// Concat hash2 to hash1 (hash1 is modified)
|
||||||
|
BIN
src/énoncé.pdf
BIN
src/énoncé.pdf
Binary file not shown.
Loading…
Reference in New Issue
Block a user