Chore: Format all files
This commit is contained in:
parent
6401660479
commit
e03915aa8d
7 changed files with 63 additions and 61 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -3,5 +3,6 @@
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"functional": "c",
|
"functional": "c",
|
||||||
"helper.h": "c"
|
"helper.h": "c"
|
||||||
}
|
},
|
||||||
|
"editor.formatOnSave": true
|
||||||
}
|
}
|
|
@ -17,7 +17,8 @@ void md2_hash(size_t len, const uint8_t buf[], uint8_t out[16]);
|
||||||
* @brief Calculates checksum of buf and appends it to buf
|
* @brief Calculates checksum of buf and appends it to buf
|
||||||
*
|
*
|
||||||
* @param len Length of data which the checksum should be calculated of
|
* @param len Length of data which the checksum should be calculated of
|
||||||
* @param buf Location of the data. Make sure to reserve 16 bytes more so the chechsum fits!
|
* @param buf Location of the data. Make sure to reserve 16 bytes more so the
|
||||||
|
* chechsum fits!
|
||||||
*/
|
*/
|
||||||
void md2_checksum(size_t len, uint8_t* buf);
|
void md2_checksum(size_t len, uint8_t* buf);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ void help(char *progname) {
|
||||||
progname);
|
progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum argumentParseResult parseArguments(int argc, char **argv, struct configuration* c) {
|
enum argumentParseResult parseArguments(int argc, char **argv,
|
||||||
|
struct configuration *c) {
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
return RESULT_EXIT_FAILURE;
|
return RESULT_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ static uint8_t* read_file(const char* path, size_t* size) {
|
||||||
|
|
||||||
uint8_t* data = malloc(statOfFile.st_size);
|
uint8_t* data = malloc(statOfFile.st_size);
|
||||||
|
|
||||||
size_t bytesRead = fread(data, statOfFile.st_blksize, statOfFile.st_blocks, f);
|
size_t bytesRead =
|
||||||
|
fread(data, statOfFile.st_blksize, statOfFile.st_blocks, f);
|
||||||
// Or: size_t bytesRead = fread(data, sizeof(char), statOfFile.st_size, f);
|
// Or: size_t bytesRead = fread(data, sizeof(char), statOfFile.st_size, f);
|
||||||
if (bytesRead != 0 && !feof(f)) {
|
if (bytesRead != 0 && !feof(f)) {
|
||||||
printf("Error reading file!\n");
|
printf("Error reading file!\n");
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
#include "md2.h"
|
#include "md2.h"
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
struct configuration c;
|
struct configuration c;
|
||||||
enum argumentParseResult result = parseArguments(argc, argv, &c);
|
enum argumentParseResult result = parseArguments(argc, argv, &c);
|
||||||
|
|
||||||
switch (result)
|
switch (result) {
|
||||||
{
|
|
||||||
case RESULT_EXIT_SUCCESS:
|
case RESULT_EXIT_SUCCESS:
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
case RESULT_EXIT_FAILURE:
|
case RESULT_EXIT_FAILURE:
|
||||||
|
@ -17,7 +15,10 @@ int main(int argc, char** argv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Hashing file: %s\nUsing implementation: %d, doing benchmark: %d, benchmark cycles: %d\n", c.filename, c.implementationToUse, c.doBenchmark, c.benchmarkingCycles);
|
printf(
|
||||||
|
"Hashing file: %s\nUsing implementation: %d, doing benchmark: %d, "
|
||||||
|
"benchmark cycles: %d\n",
|
||||||
|
c.filename, c.implementationToUse, c.doBenchmark, c.benchmarkingCycles);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
// The file "testfile" should lead to this hash: fc982e558db259f298b43cd4c1241c66
|
// The file "testfile" should lead to this hash:
|
||||||
|
// fc982e558db259f298b43cd4c1241c66
|
||||||
|
|
||||||
void md2_checksum(size_t len, uint8_t* buf) {
|
void md2_checksum(size_t len, uint8_t* buf) {}
|
||||||
|
|
||||||
}
|
void md2_hash(size_t len, const uint8_t buf[len], uint8_t out[16]) {}
|
||||||
|
|
||||||
void md2_hash(size_t len, const uint8_t buf[len], uint8_t out[16]) {
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue