求一个能用的MD5算法。要求有主函数的。谢谢!

作者&投稿:城玛 (若有异议请与网页底部的电邮联系)
有什么方法,和函数能得到文件的md5,sha值吗~

俗点讲: 两个文件MD5值或者SHA1值相同的文件,那就能断定是完全相同的文件了, 比如文件A和文件B, 通过一定的算法,得到A的MD5值和B的MD5值,

介绍MD5加密算法基本情况MD5的全称是Message-Digest Algorithm 5,在90年代初由MIT的计算机科学实验室和RSA Data Security Inc发明,经MD2、MD3和MD4发展而来。
Message-Digest泛指字节串(Message)的Hash变换,就是把一个任意长度的字节串变换成一定长的大整数。请注意我使用了"字节串"而不是"字符串"这个词,是因为这种变换只与字节的值有关,与字符集或编码方式无关。

MD5将任意长度的"字节串"变换成一个128bit的大整数,并且它是一个不可逆的字符串变换算法,换句话说就是,即使你看到源程序和算法描述,也无法将一个MD5的值变换回原始的字符串,从数学原理上说,是因为原始的字符串有无穷多个,这有点象不存在反函数的数学函数。

MD5的典型应用是对一段Message(字节串)产生fingerprint(指纹),以防止被"篡改"。举个例子,你将一段话写在一个叫readme.txt文件中,并对这个readme.txt产生一个MD5的值并记录在案,然后你可以传播这个文件给别人,别人如果修改了文件中的任何内容,你对这个文件重新计算MD5时就会发现。如果再有一个第三方的认证机构,用MD5还可以防止文件作者的"抵赖",这就是所谓的数字签名应用。

MD5还广泛用于加密和解密技术上,在很多操作系统中,用户的密码是以MD5值(或类似的其它算法)的方式保存的,用户Login的时候,系统是把用户输入的密码计算成MD5值,然后再去和系统中保存的MD5值进行比较,而系统并不"知道"用户的密码是什么。

一些黑客破获这种密码的方法是一种被称为"跑字典"的方法。有两种方法得到字典,一种是日常搜集的用做密码的字符串表,另一种是用排列组合方法生成的,先用MD5程序计算出这些字典项的MD5值,然后再用目标的MD5值在这个字典中检索。

即使假设密码的最大长度为8,同时密码只能是字母和数字,共26+26+10=62个字符,排列组合出的字典的项数则是P(62,1)+P(62,2)....+P(62,8),那也已经是一个很天文的数字了,存储这个字典就需要TB级的磁盘组,而且这种方法还有一个前提,就是能获得目标账户的密码MD5值的情况下才可以。

在很多电子商务和社区应用中,管理用户的Account是一种最常用的基本功能,尽管很多Application Server提供了这些基本组件,但很多应用开发者为了管理的更大的灵活性还是喜欢采用关系数据库来管理用户,懒惰的做法是用户的密码往往使用明文或简单的变换后直接保存在数据库中,因此这些用户的密码对软件开发者或系统管理员来说可以说毫无保密可言,本文的目的是介绍MD5的Java Bean的实现,同时给出用MD5来处理用户的Account密码的例子,这种方法使得管理员和程序设计者都无法看到用户的密码,尽管他们可以初始化它们。但重要的一点是对于用户密码设置习惯的保护

你把下面的代码复制下来,保存成md5lib.h,然后在C代码中:
#include "md5lib.h" 即可
其中:
char* MDString (char *string);是对字符串进行MD5
char* MDFile (char *filename);是对文件进行MD5
以下是代码
//--------------------------------
/* MD5lib.h - md5 library
*/

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

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.
*/

/* The following makes MD default to MD5 if it has not already been
defined with C compiler flags.
*/

#include <stdio.h>
#include <time.h>
#include <string.h>

#define MD 5

/* GLOBAL.H - RSAREF types and constants
*/

/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif

/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;

/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;

/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;

/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif

/* Length of test block, number of test blocks.
*/
#define TEST_BLOCK_LEN 1000
#define TEST_BLOCK_COUNT 1000

/* Constants for MD5Transform routine.
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21

char* MDString PROTO_LIST ((char *));
char* MDFile PROTO_LIST ((char *));
char* hmac_md5(char* text, char* key);

typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;

/*void MD5Init PROTO_LIST ((MD5_CTX *));
void MD5Update PROTO_LIST
((MD5_CTX *, unsigned char *, unsigned int));
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CT X *));

static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
static void Encode PROTO_LIST
((unsigned char *, UINT4 *, unsigned int));
static void Decode PROTO_LIST
((UINT4 *, unsigned char *, unsigned int));
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
*/
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

/* F, G, H and I are basic MD5 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))

/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))

/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
#define GG(a, b, c, d, x, s, ac) {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
#define HH(a, b, c, d, x, s, ac) {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
#define II(a, b, c, d, x, s, ac) {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
void MD5Init (MD5_CTX *context);
void MD5Update(MD5_CTX *context, unsigned char *input,unsigned int inputLen);

void MD5Final (unsigned char digest[16], MD5_CTX *context);
static void MD5Transform (UINT4 [4], unsigned char [64]) ;
static void Encode(unsigned char *, UINT4 *, unsigned int);
static void Decode (UINT4 *, unsigned char *, unsigned int);
static void MD5_memcpy(POINTER, POINTER, unsigned int);
static void MD5_memset(POINTER, int, unsigned int);

/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
void MD5Init (MD5_CTX *context)
/* context */
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}

/* MD5 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
void MD5Update (MD5_CTX *context, unsigned char *input,unsigned int inputLen )
/* context */
/* input block */
/* length of input block */
{
unsigned int i, index, partLen;

/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);

/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);

partLen = 64 - index;

/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);

for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);

index = 0;
}
else
i = 0;

/* Buffer remaining input */
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
}

/* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
void MD5Final (unsigned char digest[16], MD5_CTX *context)
/* message digest */
/* context */
{
unsigned char bits[8];
unsigned int index, padLen;

/* Save number of bits */
Encode (bits, context->count, 8);

/* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context,(unsigned char*) PADDING, padLen);

/* Append length (before padding) */
MD5Update (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);

/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)context, 0, sizeof (*context));
}

/* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform (UINT4 state[4],
unsigned char block[64])

{
int i=0;

UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];

Decode (x, block, 64);

/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */

/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */

/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */

/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */

state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;

/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
}

/* Encodes input (UINT4) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode (unsigned char *output,
UINT4 *input,
unsigned int len)

{
unsigned int i, j;

for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}

/* Decodes input (unsigned char) into output (UINT4). Assumes len is
a multiple of 4.
*/
static void Decode (UINT4 *output,
unsigned char *input,
unsigned int len)

{
unsigned int i, j;

for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}

/* Note: Replace "for loop" with standard memcpy if possible.
*/

static void MD5_memcpy (POINTER output,
POINTER input,
unsigned int len)

{
unsigned int i;

for (i = 0; i < len; i++)
output[i] = input[i];
}

/* Note: Replace "for loop" with standard memset if possible.
*/
static void MD5_memset (POINTER output,
int value,
unsigned int len)

{
unsigned int i;

for (i = 0; i < len; i++)
((char *)output)[i] = (char)value;
}

/* Digests a string and prints the result.
*/
char* MDString (char *string)

{
MD5_CTX context;
unsigned char digest[16];
char output1[32];
static char output[33]={""};
unsigned int len = strlen (string);
int i;
MD5Init (&context);
MD5Update (&context, (unsigned char*)string, len);
MD5Final (digest, &context);

for (i = 0; i < 16; i++)
{sprintf(&(output1[2*i]),"%02x",(unsigned char)digest[i]);
sprintf(&(output1[2*i+1]),"%02x",(unsigned char)(digest[i]<<4));
}
for(i=0;i<32;i++)
output[i]=output1[i];
return output;
}

/* Digests a file and prints the result.
*/
char* MDFile (char *filename)

{ static char output[33]={""};
FILE *file;
MD5_CTX context;
int len;
unsigned char buffer[1024], digest[16];
int i;
char output1[32];
if ((file = fopen (filename, "rb")) == NULL)
{ printf ("%s can't be openedn", filename);
return 0;
}
else {
MD5Init (&context);
while (len = fread (buffer, 1, 1024, file))
MD5Update (&context, buffer, len);
MD5Final (digest, &context);
fclose (file);
for (i = 0; i < 16; i++)
{sprintf(&(output1[2*i]),"%02x",(unsigned char)digest[i]);
sprintf(&(output1[2*i+1]),"%02x",(unsigned char)(digest[i]<<4));
}
for(i=0;i<32;i++)
output[i]=output1[i];
return output;
}
}

char* hmac_md5(char* text,char* key)
{
char digest[16];
char output1[32];
static char output[33]={""};
MD5_CTX context;
unsigned char k_ipad[65]; /* inner padding -
* key XORd with ipad
*/
unsigned char k_opad[65]; /* outer padding -
* key XORd with opad
*/
unsigned char tk[16];
int i;
int text_len = strlen (text);
int key_len=strlen(key);
/* if key is longer than 64 bytes reset it to key=MD5(key) */
if (key_len > 64) {

MD5_CTX tctx;

MD5Init(&tctx);
MD5Update(&tctx,(unsigned char*) key, key_len);
MD5Final(tk, &tctx);

key = (char*)tk;
key_len = 16;
}

/*
* the HMAC_MD5 transform looks like:
*
* MD5(K XOR opad, MD5(K XOR ipad, text))
*
* where K is an n byte key
* ipad is the byte 0x36 repeated 64 times
* opad is the byte 0x5c repeated 64 times
* and text is the data being protected
*/

/* start out by storing key in pads */

/*bzero( k_ipad, sizeof k_ipad);
bzero( k_opad, sizeof k_opad);
*/

for(i=0;i<65;i++)
k_ipad[i]=(unsigned char)0;
for(i=0;i<65;i++)
k_opad[i]=(unsigned char)0;

/*bcopy( key, k_ipad, key_len);
bcopy( key, k_opad, key_len);
*/
for(i=0;i<key_len;i++)
{k_ipad[i]=(unsigned char)key[i];
k_opad[i]=(unsigned char)key[i];
}

/* XOR key with ipad and opad values */
for (i=0; i<64; i++) {
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
/*
* perform inner MD5
*/
MD5Init(&context); /* init context for 1st
* pass */
MD5Update(&context, k_ipad, 64); /* start with inner pad */
MD5Update(&context, (unsigned char*)text, text_len); /* then text of datagram

*/
MD5Final((unsigned char*)digest, &context); /* finish up 1st pass */
/*
* perform outer MD5
*/
MD5Init(&context); /* init context for 2nd
* pass */
MD5Update(&context, k_opad, 64); /* start with outer pad */
MD5Update(&context,(unsigned char*) digest, 16); /* then results of 1st
* hash */
MD5Final((unsigned char*)digest, &context); /* finish up 2nd pass */
for (i = 0; i < 16; i++)
{sprintf(&(output1[2*i]),"%02x",(unsigned char)digest[i]);
sprintf(&(output1[2*i+1]),"%02x",(unsigned char)(digest[i]<<4));
}
for(i=0;i<32;i++)
output[i]=output1[i];
return output;
}


MD5值计算器使用方法
首先,处理文件MD5值:只需将需要计算的文件直接拖放到MD5值窗口内,计算器会自动对文件进行处理,显示出对应的MD5值和文件大小信息。其次,针对字符串MD5值,您可以选择字符串输入的方式。在计算器的编辑框中,键入您想要计算的字符串,点击“计算”按钮,程序会快速生成该字符串的MD5值。最后,如果您需...

分享国内常用的免费MD5在线解密网站,这5个网站很实用
四、TTMD5 TTMD5专业针对md5等哈希算法进行在线解密,可上传文件在线批量破解,最多可支持数万个密码,一般的查询是免费的。该站支持的在线解密算法包括:md5解密,md5(md5($pass)),md5(md5(md5($pass))),MD5(MD5($pass)),MD5(MD5(MD5($pass))),md4解密,sha1解密,md5(SHA1),sha256解...

分享国内常用的免费MD5在线解密网站,这5个网站很实用
如果你需要解密的文件数量众多,TTMD5的在线批量破解功能将派上用场。它支持多种复杂的哈希算法,包括md5、sha1、sha256等,甚至包括部分Salt,为破解工作提供了全方位的支持。对于需要会员服务的高级用户,查MD5提供了专业的查md5服务,支持多种算法,随着不断的技术升级,它的运算能力和速度也在不断增长...

实用Tips:计算MD5值的几个方法
md5值是一个128位的二进制数据, 转换成16进制则是32(128\/4)位的进制值。md5校验, 有很小的概率不同的文件生成的md5可能相同.比md5更安全的校验算法还有SHA*系列的.方法一:工具计算 MiniMD5_v1.1.exe        QLZQMD5.exe 使用方法:打开工具,选择所需计算文件即可...

如何使用MD5验证工具
1、运行MD5校验工具,点击”浏览”选项,可以浏览添加你需要校验的软件,镜像或视频文件等等 2、打开搜索一个镜像,比如win7旗舰版,下载该软件的文件系统信息MD5值如下图( 注意下载软件之前把这个MD5数值最好拷贝截图下来,待会软件下载好之后需要进行验证)。3、点击浏览进行添加文件 4、添加好文件之后,...

如何查看文件md5值?
MD5的全称是Message-Digest Algorithm 5,它一种被广泛使用的密码散列函数,可以产生出一个128位(16字节)的散列值(hash value),用于确保信息传输完整一致。MD5值等同于文件的ID,它的值是唯一的。 如果文件已被修改(例如嵌入式病毒,特洛伊木马等),其MD5值将发生变化。 因此,一些常规下载URL提供...

md5校验工具是干什么用的?
MD5校验工具,其实就是一个MD5加密计算的软件。软件可以计算得到文件的MD5值,再跟官方给出的MD5值进行对比没有差别就说明软件没有经过修改了。MD5简单来说是可以说是文件的“数字指纹”,常用于文件的加密和解密。任何一个文件都有且只有一个独一无二的MD5信息值,并且如果这个文件被修改过,它的MD5值...

求一个计算文件MD5的程序(C或C++都行)
MD5_SUB_ARRAY sub_array;}MD5_TRANSFORM_PARAM;const double MAX_INT = (double)0xFFFFFFFF + 1.0;const UINT MD5_TRANSFORM_MATRIX[4][16][3] = {{ { 0, 7, 1}, { 1,12, 2}, { 2,17, 3}, { 3,22, 4},{ 4, 7, 5}, { 5,12, 6}, { 6,17, 7}, { 7,22, ...

如何使用MD5验证文件完整性?
1、一般下载大型游戏和软件都会提供MD5、SHA1、CRC32来验证数据是完整性;2、右键点击下载完的或别人发送的文件,选择“其他压缩命令”,点击“计算MD5”(需要安装压缩软件);3、依次输入下载网站或提供发过来的MD5、SHA1、CRC32来比对是否错误。也可以保存MD5、SHA1、CRC32来发送给别人验证;4、如果是...

谁能给个MD5算法公式?
md5_FF d, a, b, c, x(k + 1), S12, &HE8C7B756 md5_FF c, d, a, b, x(k + 2), S13, &H242070DB md5_FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE md5_FF a, b, c, d, x(k + 4), S11, &HF57C0FAF md5_FF d, a, b, c, x(k + 5), S12, &H4787C...

咸阳市15266722745: 求一个c# md5加密算法的实例,要有说明的 -
召瑗茵栀:string pwd = &quot.Cryptography;); / 加密后是一个字节类型的数组 byte[] s=md5.格式后的字符是小写的字母;; using System,如果使用大写(X)则格式后的字符是大写字符 pwd = pwd + s[i].Create(); s.Text; 将得到的字符串使用十六...

咸阳市15266722745: python,求一个获取文件md5的算法 -
召瑗茵栀: 1. python中文件的MD5算法和简单字符串的MD5是一样的2. 如果文件太大,需要读取一段,update一下,最后读取完了一次hexdigest()就可以3. 具体MD5的用法如下:4. m=hashlib.md5() m.update(src) print(m.hexdigest())

咸阳市15266722745: 求一个Java MD5加密算法
召瑗茵栀: private static void Md5(String plainText ) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset &lt; b.length; ...

咸阳市15266722745: 求MD5加密算法代码,能运行的 -
召瑗茵栀: package endecrypt; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException;/*** 采用MD5加密解密* @author tfq* @datetime 2011-10-13*/ public class MD5Util {/**** MD...

咸阳市15266722745: 求一个加密解密算法,密钥为不限,要求密文为数字和字母组成! -
召瑗茵栀: 下面的是C#md5加密算法的实例 using System.Security.Cryptography; using System.Text;#region 加密密码,UserMd5(string str1) protected string UserMd5(string str1) { string cl1 = str1; string pwd = ""; MD5 md5 = MD5.Create(); // 加密后...

咸阳市15266722745: 求简单的md5解密函数 -
召瑗茵栀: lz的是经典的pascal(或者 delphi) 这个不是md5加密,md5没有解密方法,只有王小云教授的干扰法 这个是简单的异或,再异或一次就可以得到原文: 对密文 for I := 1 to Length(PassStr) do PassStr[I] := Char(Integer(PassStr[I]) xor I); 这样就看到原文了. 异或加密用处不大,通过几个密文,就可以看出是否是用的异或加密

咸阳市15266722745: 求一个php md5 加密源码 -
召瑗茵栀: php自带的md5加密函数 echo md('aaa', true); //这样就可以生成16位的标准加密

咸阳市15266722745: 求一个易语言MD5加密的算法 -
召瑗茵栀: MD5(Message-Digest Algorithm 5,信息-摘要算法 5),用于确保信息传输完整一致.是计算机广泛使用的杂凑算法之一(又译摘要算法、哈希算法、Hash算法),主流编程语言普遍已有MD5实现.将数据(如英文字符串,汉字,文件等)运...

咸阳市15266722745: 求48位的md5值算法 -
召瑗茵栀: 莫非是在32位MD5末尾再加上它的16位MD5....

咸阳市15266722745: 求一个Symbian MD5算法的实现
召瑗茵栀: 看 http://www.devdiv.com/viewthread.php?tid=2735&highlight=%2Bmiyunhong的#9楼.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网