gra-projekt/Implementierung/lib/md2.h

40 lines
1001 B
C

#ifndef MD2_H
#define MD2_H
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
typedef void (*md2_hash_func)(size_t len, const uint8_t buf[len],
uint8_t out[16]);
/**
* @brief Calculates checksum of buf and stores it in out
*
* @param len Length of the data at buf
* @param buf Location of the data
* @param out Destination array of for the checksum
*/
extern md2_hash_func md2_hash;
/**
* @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);
/**
* @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
*/
void md2_encode_hash(uint8_t hash[16], char* string_hash);
#endif // MD2_H