2022-06-29 10:58:49 +02:00
|
|
|
#ifndef MD2_H
|
|
|
|
#define MD2_H
|
|
|
|
|
2022-07-04 18:02:34 +02:00
|
|
|
#include <stdbool.h>
|
2022-06-29 10:58:49 +02:00
|
|
|
#include <stdint.h>
|
2022-06-29 15:41:56 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2022-06-29 11:08:31 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2022-07-06 20:35:27 +02:00
|
|
|
typedef void (*md2_hash_func)(size_t len, const uint8_t buf[len],
|
|
|
|
uint8_t out[16]);
|
2022-07-04 18:02:34 +02:00
|
|
|
|
2022-06-29 11:08:31 +02:00
|
|
|
/**
|
|
|
|
* @brief Calculates checksum of buf and stores it in out
|
2022-06-29 11:12:35 +02:00
|
|
|
*
|
2022-06-29 11:08:31 +02:00
|
|
|
* @param len Length of the data at buf
|
|
|
|
* @param buf Location of the data
|
|
|
|
* @param out Destination array of for the checksum
|
|
|
|
*/
|
2022-07-04 18:02:34 +02:00
|
|
|
extern md2_hash_func md2_hash;
|
2022-06-29 11:08:31 +02:00
|
|
|
|
2022-07-04 18:02:34 +02:00
|
|
|
/**
|
|
|
|
* @brief Choose the implementation to use
|
|
|
|
*
|
|
|
|
* @param i the implementation
|
|
|
|
* @return true when the implemenatation was changed
|
|
|
|
* @return false when the implementation does not exist
|
|
|
|
*/
|
|
|
|
bool md2_choose_implementation(int i);
|
2022-06-29 10:58:49 +02:00
|
|
|
|
2022-06-29 22:02:18 +02:00
|
|
|
/**
|
|
|
|
* @brief Takes a uint8_t array and converts it into a string
|
|
|
|
*
|
|
|
|
* @param hash the array containing the hash
|
|
|
|
* @param stringHash pointer to store the string, has to have 32 bytes space
|
|
|
|
*/
|
2022-07-04 18:02:34 +02:00
|
|
|
void md2_encode_hash(uint8_t hash[16], char* string_hash);
|
2022-06-29 19:03:12 +02:00
|
|
|
|
2022-06-29 11:12:35 +02:00
|
|
|
#endif // MD2_H
|