⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 md5.h

📁 一个加密库代码
💻 H
字号:
/*
 * Copyright 1997-2005 Markus Hahn 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __MD5_H
#define __MD5_H

#include "cpconfig.h"
#include "BasicTypes.h"


#ifdef __cplusplus
extern "C" {
#endif

// size of an MD5 digest
#define MD5_DIGESTSIZE  16


// MD5 context

typedef struct
{
  WORD32 state[4];  // state (ABCD)
  WORD32 count[2];  // number of bits, modulo 2^64 (lsb first)
  WORD8 buffer[64]; // input buffer
}
MD5CTX, *PMD5CTX;



/*
 * initialization, begins an MD5 operation, writing a new context
 * <- pointer to new MD5 context
 */
PMD5CTX CRYPTPAK_API 
    MD5_Create ();


/*
 * same initialization, but statically
 * -> pointer to MD5 context
 */
void CRYPTPAK_API 
    MD5_Initialize (PMD5CTX);


/*
 * resets an MD5 context
 * -> context to rest
 */
void CRYPTPAK_API 
    MD5_Reset (PMD5CTX);


/*
 * releases an MD5 context
 * -> pointer to MD5 context to release
 */
void CRYPTPAK_API 
    MD5_Destroy (PMD5CTX);


/*
 * block update operation, continues an MD5 message-digest operation,
 * processing another message block, and updating the context
 * -> pointer to MD5 context
 * -> pointer to input buffer, which is treated as a byte buffer
 * -> number of bytes to scramble
 */
void CRYPTPAK_API 
    MD5_Update (PMD5CTX, const void*, WORD32);



/*
 * MD5 finalization, ends an MD5 message-digest operation,
 * writing the message digest and clearing the context
 * -> buffer where to copy the digest's bytes
 * -> pointer to MD5 context
 */
void CRYPTPAK_API 
    MD5_Final (WORD8*, PMD5CTX);


/*
 * selftest
 * <- BOOL_TRUE: selftest succeded / BOOL_FALSE: error
 */
BYTEBOOL CRYPTPAK_API 
    MD5_SelfTest();


#ifdef __cplusplus
}
#endif


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -