gra-projekt/Implementierung/lib/md2.h

36 lines
943 B
C
Raw Normal View History

2022-06-29 10:58:49 +02:00
#ifndef MD2_H
#define MD2_H
#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>
/**
* @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
*/
void md2_hash(size_t len, const uint8_t buf[], uint8_t out[16]);
/**
* @brief Calculates checksum of buf and appends it to buf
2022-06-29 11:12:35 +02:00
*
2022-06-29 11:08:31 +02:00
* @param len Length of data which the checksum should be calculated of
2022-06-29 11:12:35 +02:00
* @param buf Location of the data. Make sure to reserve 16 bytes more so the
* chechsum fits!
2022-06-29 11:08:31 +02:00
*/
void md2_checksum(size_t len, uint8_t* buf);
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-06-29 19:03:12 +02:00
void encodeHash(uint8_t hash[16], char* stringHash);
2022-06-29 11:12:35 +02:00
#endif // MD2_H