MD5算法(Linux C实现)

基础算法,源码实现如下: 

#include <linux/types.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ctype.h>

#define    MD5_BLOCK_LENGTH        64
#define    MD5_DIGEST_LENGTH        16

typedef struct MD5Context {
    unsigned int state[4];            /* state */
    unsigned int count[2];            /* number of bits, mod 2^64 */
    unsigned char buffer[MD5_BLOCK_LENGTH];    /* input buffer */
} MD5_CTX;

void     MD5Init(MD5_CTX *);
void     MD5Update(MD5_CTX *, unsigned char const *, size_t);
void     MD5Final(unsigned char [MD5_DIGEST_LENGTH], MD5_CTX *);
void     MD5Transform(unsigned int [4], unsigned char const [MD5_BLOCK_LENGTH]);
void     hmac_md5(unsigned char*  text,int  text_len,unsigned char*  key,int key_len,unsigned char*  digest);
#include "md5.h"

#define PUT_64BIT_LE

猜你喜欢

转载自blog.csdn.net/afk_02/article/details/118220599