mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
calculate and check hash of downloaded file
This commit is contained in:
@@ -267,7 +267,7 @@ static int _decode_folder_get_content_files(mfhttp * conn, void *user_ptr)
|
||||
file_set_revision(tmp_file,
|
||||
atoll(json_string_value(j_obj)));
|
||||
}
|
||||
// FIXME don't save hex ascii string but binary chars instead
|
||||
|
||||
j_obj = json_object_get(data, "hash");
|
||||
if (j_obj != NULL) {
|
||||
file_set_hash(tmp_file, json_string_value(j_obj));
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include "file.h"
|
||||
#include "apicalls.h"
|
||||
@@ -30,7 +31,9 @@
|
||||
struct mffile {
|
||||
char quickkey[MFAPI_MAX_LEN_KEY + 1];
|
||||
char parent[MFAPI_MAX_LEN_NAME + 1];
|
||||
char hash[65];
|
||||
/* the hex representation takes twice the amount of the binary length plus
|
||||
* 1 for the terminating zero byte */
|
||||
char hash[SHA256_DIGEST_LENGTH * 2 + 1];
|
||||
char name[MFAPI_MAX_LEN_NAME + 1];
|
||||
time_t created;
|
||||
uint64_t revision;
|
||||
|
||||
Reference in New Issue
Block a user