📄 dpl_md5.h
字号:
/*
* This is work is derived from material Copyright RSA Data Security, Inc.
*
* The RSA copyright statement and Licence for that original material is
* included below. This is followed by the Apache copyright statement and
* licence for the modifications made to that material.
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
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 DPL_MD5_H
#define DPL_MD5_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @package DPL MD5 Library
*/
#define MD5_DIGESTSIZE 16
/* UINT4 defines a four byte word */
typedef unsigned int UINT4;
typedef struct dpl_md5_ctx_t dpl_md5_ctx_t;
/** MD5 context. */
struct dpl_md5_ctx_t {
UINT4 state[4];
UINT4 count[2];
unsigned char buffer[64];
};
/**
* MD5 Initialize. Begins an MD5 operation, writing a new context.
* @param context The MD5 context to initialize.
* @deffunc apr_status_t apr_MD5Init(apr_md5_ctx_t *context)
*/
dpl_status_t dpl_MD5Init(dpl_md5_ctx_t *context);
/**
* MD5 block update operation. Continue an MD5 message-digest operation,
* processing another message block, and updating the context.
* @param context The MD5 content to update.
* @param input next message block to update
* @param inputLen The length of the next message block
* @deffunc apr_status_t apr_MD5Update(apr_md5_ctx_t *context, const unsigned char *input, unsigned int inputLen)
*/
dpl_status_t dpl_MD5Update(dpl_md5_ctx_t *context,
const unsigned char *input,
unsigned int inputLen);
/**
* MD5 finalization. Ends an MD5 message-digest operation, writing the
* message digest and zeroing the context
* @param digest The final MD5 digest
* @param context The MD5 content we are finalizing.
* @deffunc apr_status_t apr_MD5Final(unsigned char digest[MD5_DIGESTSIZE], apr_md5_ctx_t *context)
*/
dpl_status_t dpl_MD5Final(unsigned char digest[MD5_DIGESTSIZE],
dpl_md5_ctx_t *context);
/**
* Encode a password using an MD5 algorithm
* @param password The password to encode
* @param salt The salt to use for the encoding
* @param result The string to store the encoded password in
* @param nbytes The length of the string
* @deffunc apr_status_t apr_MD5Encode(const char *password, const char *salt, char *result, size_t nbytes)
*/
dpl_status_t dpl_MD5Encode(const char *password, const char *salt,
char *result, size_t nbytes);
char *dpl_md5_binary(char *out,const unsigned char *buf, int length);
#ifdef __cplusplus
}
#endif
#endif /* !DPL_MD5_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -