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

📄 md.h

📁 RSA C++源代码DEMO,附加DESMD5等众多算法
💻 H
字号:
/*******************************************************************
  md.h

    Message Digest Algorithms: MD2, MD4, MD5, SHA-1
    Written & Modified by Zhuang Hao S.S.* (Jerrey <jerrey@usa.net>)
    Copyright(C) 1998
    All Rights Reserved.
 -------------------------------------------------------------------
    ANY MODIFICATION MADE TO THIS SOURCE CODE IS AT YOUR OWN RISK.
    Please ask the author for the permission.
 *******************************************************************
    THE MD2, MD4 & MD5 ALGORITHMS ARE MODIFIED FROM THE SOURCE CODE
    GIVEN IN RFC1319-1321. PLEASE READ THE COPYRIGHT DECLARATION
    BELOW. NOTE THAT THE SOURCE CODES BELOW ARE *NOT* THE SAME AS
    THOSE GIVEN IN RFC1319-1321.
 *******************************************************************/

/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
   rights reserved.

   License to copy and use this software is granted for
   non-commercial Internet Privacy-Enhanced Mail provided that it is
   identified as the "RSA Data Security, Inc. MD2 Message Digest
   Algorithm" in all material mentioning or referencing this software
   or this function.

   RSA Data Security, Inc. makes no representations concerning either
   the merchantability of this software or the suitability of this
   software for any particular purpose. It is provided "as is"
   without express or implied warranty of any kind.

   These notices must be retained in any copies of any part of this
   documentation and/or software.
 */

#ifndef __SS_MD_DEFINED__
#define __SS_MD_DEFINED__ 1

#include    "ssglob.h"

#ifdef __cplusplus
extern "C" {
#endif


/* MD2 context. */
typedef struct {
    BYTE        state[16];                                 /* state */
    BYTE        checksum[16];                           /* checksum */
    UINT        count;                /* number of bytes, modulo 16 */
    BYTE        buffer[16];                         /* input buffer */
} MD2CTX;
/* MD4 context. */
typedef struct {
    UINT4       state[4];                           /* state (ABCD) */
    UINT4       count[2];/* number of bits, modulo 2^64 (lsb first) */
    BYTE        buffer[64];                         /* input buffer */
} MD4CTX;
/* MD5 context. */
typedef MD4CTX      MD5CTX;
/* SHA-1 context. */
typedef struct {
    UINT4       state[5];                           /* state (ABCD) */
    UINT4       count[2];/* number of bits, modulo 2^64 (lsb first) */
    BYTE        buffer[64];                         /* input buffer */
} SHA1CTX;
/* Context union */
typedef union {
    MD2CTX      md2Context;
    MD4CTX      md4Context;
    MD5CTX      md5Context;
    SHA1CTX     sha1Context;
} MDCTX;
/* Message Digest function type */
typedef void (*MD_INIT_PROC) PROTO_LIST ((MDCTX *));
typedef void (*MD_UPDATE_PROC) PROTO_LIST ((MDCTX *, const BYTE *, UINT));
typedef void (*MD_FINAL_PROC) PROTO_LIST ((BYTE [16], MDCTX *));


extern const BYTE  md2_OBJECTID[];
extern const BYTE  md4_OBJECTID[];
extern const BYTE  md5_OBJECTID[];
extern const BYTE  sha1_OBJECTID[];


extern void MD2_Init PROTO_LIST ((MD2CTX *));
extern void MD2_Update PROTO_LIST ((MD2CTX *, const BYTE *, UINT));
extern void MD2_Final PROTO_LIST ((BYTE [16], MD2CTX *));

extern void MD4_Init PROTO_LIST ((MD4CTX *));
extern void MD4_Update PROTO_LIST ((MD4CTX *, const BYTE *, UINT));
extern void MD4_Final PROTO_LIST ((BYTE [16], MD4CTX *));

extern void MD5_Init PROTO_LIST ((MD5CTX *));
extern void MD5_Update PROTO_LIST ((MD5CTX *, const BYTE *, UINT));
extern void MD5_Final PROTO_LIST ((BYTE [16], MD5CTX *));

extern void SHA1_Init PROTO_LIST ((SHA1CTX *));
extern void SHA1_Update PROTO_LIST ((SHA1CTX *, const BYTE *, UINT));
extern void SHA1_Final PROTO_LIST ((BYTE [20], SHA1CTX *));


#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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