md2.h (1076B)
1 /********************************************************************* 2 * Filename: md2.h 3 * Author: Brad Conte (brad AT bradconte.com) 4 * Copyright: 5 * Disclaimer: This code is presented "as is" without any guarantees. 6 * Details: Defines the API for the corresponding MD2 implementation. 7 *********************************************************************/ 8 9 #ifndef MD2_H 10 #define MD2_H 11 12 /*************************** HEADER FILES ***************************/ 13 #include <stddef.h> 14 15 /****************************** MACROS ******************************/ 16 #define MD2_BLOCK_SIZE 16 17 18 /**************************** DATA TYPES ****************************/ 19 typedef unsigned char BYTE; // 8-bit byte 20 21 typedef struct { 22 BYTE data[16]; 23 BYTE state[48]; 24 BYTE checksum[16]; 25 int len; 26 } MD2_CTX; 27 28 /*********************** FUNCTION DECLARATIONS **********************/ 29 void md2_init(MD2_CTX *ctx); 30 void md2_update(MD2_CTX *ctx, const BYTE data[], size_t len); 31 void md2_final(MD2_CTX *ctx, BYTE hash[]); // size of hash must be MD2_BLOCK_SIZE 32 33 #endif // MD2_H