mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-09 21:17:06 +03:00
* added md5 library * added MD5 calculation of uploaded file. And return JSON string instead of fileserver * . * . * . * . * . * . * . * . * . * Add fallback for older firmware --------- Co-authored-by: CaCO3 <caco@ruinelli.ch>
29 lines
746 B
C
29 lines
746 B
C
/* Src: https://github.com/Zunawe/md5-c, commit: f3529b6
|
|
* License: Unlicense */
|
|
#pragma once
|
|
|
|
#ifndef MD5_H
|
|
#define MD5_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef struct{
|
|
uint64_t size; // Size of input in bytes
|
|
uint32_t buffer[4]; // Current accumulation of hash
|
|
uint8_t input[64]; // Input to be used in the next step
|
|
uint8_t digest[16]; // Result of algorithm
|
|
}MD5Context;
|
|
|
|
void md5Init(MD5Context *ctx);
|
|
void md5Update(MD5Context *ctx, uint8_t *input, size_t input_len);
|
|
void md5Finalize(MD5Context *ctx);
|
|
void md5Step(uint32_t *buffer, uint32_t *input);
|
|
|
|
void md5String(char *input, uint8_t *result);
|
|
void md5File(FILE *file, uint8_t *result);
|
|
|
|
#endif // MD5_H
|