當前位置:首頁 » 密碼管理 » md5c加密解密演算法

md5c加密解密演算法

發布時間: 2022-04-20 10:18:17

Ⅰ 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密碼的例子,這種方法使得管理員和程序設計者都無法看到用戶的密碼,盡管他們可以初始化它們。但重要的一點是對於用戶密碼設置習慣的保護

Ⅱ CMD5解密

媽的一幫菜鳥不懂裝懂!算不出來就不要出聲!這個就是算出來的結果!
958118xy
本來不想回答的,才10分,但是見到一些「高手」,不答不行了。
最好加點分吧

Ⅲ MD5怎麼解密

MD5的全稱是Message-digest Algorithm 5(信息-摘要演算法),用於確保信息傳輸完整一致。在90年代初由MIT Laboratory for Computer Science和RSA Data Security Inc,的Ronald L. Rivest開發出來,經MD2、MD3和MD4發展而來。它的作用是讓大容量信息在用數字簽名軟體簽署私人密鑰前被"壓縮"成一種保密的格式(就是把一個任意長度的位元組串變換成一定長的大整數)。不管是MD2、MD4還是MD5,它們都需要獲得一個隨機長度的信息並產生一個128位的信息摘要。雖然這些演算法的結構或多或少有些相似,但MD2的設計與MD4和MD5完全不同,那是因為MD2是為8位機器做過設計優化的,而MD4和MD5卻是面向32位的電腦。這三個演算法的描述和c語言源代碼在Internet RFC 1321中有詳細的描述(),這是一份最權威的文檔,由Ronald L. Rivest在1992年8月向IETF提交。 MD5的典型應用是對一段信息(Message)產生信息摘要(Message-Digest),以防止被篡改。 所以現在會把一些軟體用MD5加密後,你下載下再用MD5工具查看,如果與提供的MD5編碼相同就是原來的,如果不同就是此文件已被修改過~~ ~

還有不明的,請問,

Ⅳ 關於哈希加密MD5演算法

四種加密解密演算法的源代碼:移位密碼、仿射密碼、維吉尼亞密碼以及置換密碼

#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <malloc.h>
void Shift() /*移位密碼*/
{
char c[100];
int length, i=0, key=0;
clrscr();

printf("********Shift Cipher********\nPlease input primal sentence: ");
gets(c);
length = strlen(c);
printf("Input the key(0~26): ");
scanf("%d", &key);
getchar();

if(key<0)
{
printf("The value of key is error!\nPress any key to return...");
getch();
return;
}
for(i=0; i<length; i++)
{
if(c[i]>96&&c[i]<123)
c[i] = (c[i]+key-97)%26+65;
else if(c[i]>64&&c[i]<91)
c[i] = (c[i]+key-65)%26+65;
}
printf("Result is: %s\n", c);
for(i=0; i<length; i++)
{
if(c[i]>64&&c[i]<91)
c[i] = (c[i]-key-65+26)%26+97;
}
printf("\nAfter translated the sentence,we can see the primal sentence as follow:\n%s\n", c);
printf("Press any key to return...");
getch();
}

int gcd(int a, int b) /*輾轉相除法求a,b的最大公因數*/
{
int k = 0;

do
{
k = a%b;
a = b;
b = k;
}while(k!=0);
return a;
}

int Ni(int a, int b) /*求a相對於b的逆*/
{
int i = 0;
while(a*(++i)%b!=1);
return i;
}

void Affine() /*仿射密碼*/
{
char c[100];
int length, i=0, ka=0, kb=0, tmp;
clrscr();

printf("********Affine Cipher********\nPlease input primal sentence: ");
gets(c);
length = strlen(c);
printf("Input the key(2 numbers): ");
scanf("%d%d", &ka, &kb);
getchar();
if(gcd(ka,26)!=1)
{
printf("The value of the key is error!\nPress any key to return...");
return;
}

for(i=0; i<length; i++)
{
if(c[i]>96&&c[i]<123)
c[i] = (ka*(c[i]-97)+kb)%26+65;
else if(c[i]>64&&c[i]<91)
c[i] = (ka*(c[i]-65)+kb)%26+65;
}
printf("Result is: %s\n", c);
for(i=0; i<length; i++)
{
if(c[i]>64&&c[i]<91)
{
tmp = Ni(ka,26)*((c[i]-65)-kb);
if(tmp<0)
c[i] = tmp%26+26+97;
else
c[i] = tmp%26+97;
}
}
printf("\nAfter translated the sentence,we can see the primal sentence as follow:\n%s\n", c);
printf("Press any key to return...");
getch();
}

void Vigenere() /*維吉利亞密碼*/
{
char c[100], key[100];
int lenc, lenk, i=0, j=0, tmp;
clrscr();

printf("********Vigenere Cipher********\nPlease input primal sentence: ");
gets(c);
lenc = strlen(c);
strcpy(c, strupr(c));
printf("Input the key: ");
gets(key);
lenk = strlen(key);
strcpy(key, strupr(key));
for(; i<lenc; i++)
{
j = j%lenk;
if(c[i]>64&&c[i]<91)
{
c[i] = (c[i]-65+key[j]-65)%26+65;
j++;
}
}
printf("Result is: %s\n", c);
for(i=0, j=0; i<lenc; i++)
{
j = j%lenk;
if(c[i]>64&&c[i]<91)
{
tmp = c[i]-65-(key[j]-65);
if(tmp>=0)
c[i] = tmp%26+97;
else
c[i] = (tmp+26)%26+97;
j++;
}
}
printf("\nAfter translated the sentence,we can see the primal sentence as follow:\n%s\n", c);
printf("Press any key to return...");
getch();
}

void Permutation() /*置換密碼*/
{
char c[100], *q;
int *key, len, m, i, j=0;
clrscr();

printf("********Permutation Cipher********\nPlease input primal sentence: ");
gets(c);
strcpy(c, strupr(c));
len = strlen(c);
for(i=0; i<len; i++)
{
if(c[i]<65||c[i]>90)
{
for(j=i; j<len-1; j++)
c[j] = c[j+1];
len--;
}
}
c[len] = '\0';
printf("Input the length of the key: ");
scanf("%d", &m);
key = (int)malloc(m*sizeof(int));
q = (int)malloc(len*sizeof(int));
printf("Input the key: ");
for(i=0; i<m; i++)
{
scanf("%d", key+i);
key[i]--;
}
getchar();

for(i=0; i<len; i++)
{
j = (i/m)*m;
q[i] = c[*(key+i%m)+j];
}
q[i] = '\0';

printf("Result is: %s\n", q);

for(i=0, j=0; i<len; i++)
{
j = (i/m)*m;
c[*(key+i%m)+j] = q[i]+32;
}
c[len] = '\0';

printf("After translated the sentence,we can see the primal sentence as follow:\n%s\n", c);
printf("Press any key to return...");
free(key);
free(q);
getch();
}

void main()
{
char i = '0';
clrscr();

while(i!='5')
{
clrscr();
printf("********Press 1~5 to choose:********\n");
printf("1. Shift Cipher\n2. Affine Cipher\n3. Vigenere Cipher\n4. Permutation Cipher\n5. Exit\n");
i = getch();
if(i=='1')
Shift();
else if(i=='2')
Affine();
else if(i=='3')
Vigenere();
else if(i=='4')
Permutation();
else if(i=='5')
break;
}
}

Ⅳ 急求 MD5的加密解密演算法,用C++實現的源代碼 高分答謝

要代碼,還是要相關的解釋資料?

---------------------------------
要代碼的話:

兩個文件:
--------------------------
1. md5.h:

#pragma once

typedef unsigned long int UINT32;
typedef unsigned short int UINT16;

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

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

--------------------------
2. md5.cpp:

#include "md5.h"

#include "memory.h"

#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

static void MD5Transform (UINT32 a[4], unsigned char b[64]);
static void Encode (unsigned char *, UINT32 *, unsigned int);
static void Decode (UINT32 *, unsigned char *, 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
};

#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)))

#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))

#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (UINT32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (UINT32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (UINT32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (UINT32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}

void MD5Init (MD5_CTX *context)
{
context->count[0] = context->count[1] = 0;

context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}

void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;

index = (unsigned int)((context->count[0] >> 3) & 0x3F);

if ((context->count[0] += ((UINT32)inputLen << 3))
< ((UINT32)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT32)inputLen >> 29);

partLen = 64 - index;

if (inputLen >= partLen) {
memcpy((unsigned char *)&context->buffer[index], (unsigned char *)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;

memcpy((unsigned char *)&context->buffer[index], (unsigned char *)&input[i],
inputLen-i);
}

void MD5Final (unsigned char digest[16], MD5_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;

Encode (bits, context->count, 8);

index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context, PADDING, padLen);

MD5Update (context, bits, 8);

Encode (digest, context->state, 16);

memset ((unsigned char *)context, 0, sizeof (*context));
}

static void MD5Transform (UINT32 state[4], unsigned char block[64])
{
UINT32 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;

memset ((unsigned char *)x, 0, sizeof (x));
}

static void Encode (unsigned char *output, UINT32 *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);
}
}

static void Decode (UINT32 *output, unsigned char *input, unsigned int len)
{
unsigned int i, j;

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

--------------------------
就這兩個文件。使用的時候把它們加入工程或者makefile,調用時包含md5.h即可,給個簡單的例子,輸入一個字元串然後計算它的md5值並輸出,在VC6.0和GCC4.4下測試通過:

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

#include "md5.h"

int main ()
{
char tmp[128];
unsigned char digest[16];

MD5_CTX context;

scanf("%s",tmp);

MD5Init (&context);
MD5Update (&context, (unsigned char*)tmp, strlen(tmp));
MD5Final (digest,&context);

printf("MD5Value:");
for(int i=0; i<16; ++i)
{
printf("%02X",digest[i]);
}
printf("\n");

return 0;
}

Ⅵ MD5如何解密

MD5的全稱是Message-digest Algorithm 5(信息-摘要演算法),用於確保信息傳輸完整一致。在90年代初由MIT Laboratory for Computer Science和RSA Data Security Inc,的Ronald L. Rivest開發出來,經MD2、MD3和MD4發展而來。它的作用是讓大容量信息在用數字簽名軟體簽署私人密鑰前被"壓縮"成一種保密的格式(就是把一個任意長度的位元組串變換成一定長的大整數)。不管是MD2、MD4還是MD5,它們都需要獲得一個隨機長度的信息並產生一個128位的信息摘要。雖然這些演算法的結構或多或少有些相似,但MD2的設計與MD4和MD5完全不同,那是因為MD2是為8位機器做過設計優化的,而MD4和MD5卻是面向32位的電腦。這三個演算法的描述和c語言源代碼在Internet RFC 1321中有詳細的描述(),這是一份最權威的文檔,由Ronald L. Rivest在1992年8月向IETF提交。 MD5的典型應用是對一段信息(Message)產生信息摘要(Message-Digest),以防止被篡改。 所以現在會把一些軟體用MD5加密後,你下載下再用MD5工具查看,如果與提供的MD5編碼相同就是原來的,如果不同就是此文件已被修改過~~ ~

Ⅶ ACCESS 中MD5加密後怎麼解密

MD5是一種不可逆的加密演算法,
什麼是不可逆呢?就是加了密後,就不能解了。
現在網上的諸多所謂的「MD5解密工具」其實都是暴力破解,什麼叫暴力破解呢?
那就是這些軟體都有一些「字典文件」,其實就是一些常用的字元串及其加密過後的md5密文,例:軟體首先把a加密成md5密文,然後用密文和現在要破解的密文進行比較,如果相同,那當然就破解了是a,如果不同,那麼依此繼續將b,c... 作同樣的處理,也就是說,這些破解工具完全是用猜的,a不行猜b,b不行猜c,用循環一直往下猜。所以你想要找一個md5解密的軟體,我勸樓主還是省了這份心吧,因為這些軟體破解成功的機率很小。。
那麼明白了md5後,即然它只能加密,不能解密,我們通常用它做什麼呢?我們主要用它加密一些敏感數據,如用戶的密碼,把密碼加密成md5後存入資料庫。這樣即使用戶得到了資料庫,也不知道用戶的密碼是什麼。
那麼我們是怎麼來使用這個密文的呢?也就是用戶在登錄的時候,是怎麼判斷用戶輸入的密碼是不是和資料庫中的密碼(md5加密後的)一致的呢?我們是在用戶登錄的時候,把用戶輸入的密碼再加密成md5,然後用這個加密後的md5密文和資料庫中存的用戶的md5密文來進行比較,如果兩個密文一樣,說明用戶輸對了密碼,否則就說明用戶輸入的是錯誤的密碼。

現在你知道了md5了吧?
如果md5和一般的加密演算法一樣,能加密就能輕松解密,那還有加密的意義嗎?反正加了別人也可以解,不是白加?所以md5是相對來說很安全的一種加密演算法,當然也不能說它是絕對的安全,因為畢竟還有暴力破解,如果你的密碼很簡單,別人說不定用暴力破解就把你的密碼給解出來了咯。呵呵~~
有關更多的網頁知識,請點擊:

Ⅷ 誰可以告訴我md5加密原理

2004年,已經被山東大學的王小雲教授破解了。

以下是她在國際密碼學會上發表的破解原理論文。
Collisions for Hash Functions
Collisions for Hash Functions
MD4, MD5, HAVAL-128 and RIPEMD
Xiaoyun Wang1, Dengguo Feng2, Xuejia Lai3, Hongbo Yu1
The School of Mathematics and System Science, Shandong University, Jinan250100, China1
Institute of Software, Chinese Academy of Sciences, Beijing100080, China2
Dept. of Computer Science and Engineering, Shanghai Jiaotong University, Shanghai, China3
[email protected]
revised on August 17, 2004

1 Collisions for MD5
MD5 is the hash function designed by Ron Rivest [9] as a strengthened version of MD4 [8]. In 1993 Bert den
Boer and Antoon Bosselaers [1] found pseudo-collision for MD5 which is made of the same message with two
different sets of initial value. H. Dobbertin[3] found a free-start collision which consists of two different 512-bit
messages with a chosen initial value 0 V I .
ED BA x C B F x C B AC x A V I 763 4 0 D , 97 62 5 0 , 341042 3 0x B , 2375 12 0 : 0 0 0 0 0
Our attack can find many real collisions which are composed of two 1024-bit messages with the original
initial value 0 IV of MD5:
10325476 0 , 98 0 , 89 0 67452301 0 : 0 0 0 0 0 x D badcfe x C xefcdab ,B x A IV
) 0 , 2 ,..., 2 ,..., 2 , 0 , 0 , 0 , 0 ( , 31 15 31
1 1 C C M M
) 0 , 2 ,..., 2 ,..., 2 , 0 , 0 , 0 , 0 ( , 31 15 31
2 2 C C N N i i
(non-zeros at position 4,11 and 14)
such that
) , ( 5 ) , ( 5 i i N M MD N M MD .
On IBM P690, it takes about one hour to find such M and M , after that, it takes only 15 seconds to 5
minutes to find i N and i N , so that ) , ( i N M and ) , ( i N M will proce the same hash same value. Moreover,
our attack works for any given initial value.
The following are two pairs of 1024-bit messages procing collisions, the two examples have the same 1-st
half 512 bits.
M
2dd31d1 c4eee6c5 69a3d69 5cf9af98 87b5ca2f ab7e4612 3e580440 897ffbb8
634ad55 2b3f409 8388e483 5a417125 e8255108 9fc9cdf7 f2bd1dd9 5b3c3780
X1
N1
d11d0b96 9c7b41dc f497d8e4 d555655a c79a7335 cfdebf0 66f12930 8fb109d1
797f2775 eb5cd530 baade822 5c15cc79 ddcb74ed 6dd3c55f d80a9bb1 e3a7cc35
M0
2dd31d1 c4eee6c5 69a3d69 5cf9af98 7b5ca2f ab7e4612 3e580440 897ffbb8
634ad55 2b3f409 8388e483 5a41f125 e8255108 9fc9cdf7 72bd1dd9 5b3c3780
X1
N1
d11d0b96 9c7b41dc f497d8e4 d555655a 479a7335 cfdebf0 66f12930 8fb109d1
797f2775 eb5cd530 baade822 5c154c79 ddcb74ed 6dd3c55f 580a9bb1 e3a7cc35
H 9603161f f41fc7ef 9f65ffbc a30f9dbf
M
2dd31d1 c4eee6c5 69a3d69 5cf9af98 87b5ca2f ab7e4612 3e580440 897ffbb8
634ad55 2b3f409 8388e483 5a417125 e8255108 9fc9cdf7 f2bd1dd9 5b3c3780
X2
N2
313e82d8 5b8f3456 d4ac6dae c619c936 b4e253dd fd03da87 6633902 a0cd48d2
42339fe9 e87e570f 70b654ce 1e0da880 bc2198c6 9383a8b6 2b65f996 702af76f
M0
2dd31d1 c4eee6c5 69a3d69 5cf9af98 7b5ca2f ab7e4612 3e580440 897ffbb8
634ad55 2b3f409 8388e483 5a41f125 e8255108 9fc9cdf7 72bd1dd9 5b3c3780

313e82d8 5b8f3456 d4ac6dae c619c936 34e253dd fd03da87 6633902 a0cd48d2
42339fe9 e87e570f 70b654ce 1e0d2880 bc2198c6 9383a8b6 ab65f996 702af76f
H 8d5e7019 6324c015 715d6b58 61804e08
Table 1 Two pairs of collisions for MD5
2 Collisions for HAVAL-128
HAVAL is proposed in [10]. HAVAL is a hashing algorithm that can compress messages of any length in 3,4
or 5 passes and proce a fingerprint of length 128, 160, 192 or 224 bits.
Attack on a reced version for HAVAL was given by P. R. Kasselman and W T Penzhorn [7], which
consists of last rounds for HAVAL-128. We break the full HAVAL-128 with only about the 26 HAVAL
computations. Here we give two examples of collisions of HAVAL-128, where
) 0 ,..., 0 , 2 ,.... 2 , 0 , 0 , 0 , 2 ( , 8 12 1 i i i C C M M
with non-zeros at position 0,11,18, and 31 ,... 2 , 1 , 0 i , such that ) ( ) ( M HAVAL M HAVAL .
M1
6377448b d9e59f18 f2aa3cbb d6cb92ba ee544a44 879fa576 1ca34633 76ca5d4f
a67a8a42 8d3adc8b b6e3d814 5630998d 86ea5dcd a739ae7b 54fd8e32 acbb2b36
38183c9a b67a9289 c47299b2 27039ee5 dd555e14 839018d8 aabbd9c9 d78fc632
fff4b3a7 40000096 7f466aac fffffbc0 5f4016d2 5f4016d0 12e2b0 f4307f87
M1
6377488b d9e59f18 f2aa3cbb d6cb92ba ee544a44 879fa576 1ca34633 76ca5d4f
a67a8a42 8d3adc8b b6e3d814 d630998d 86ea5dcd a739ae7b 54fd8e32 acbb2b36
38183c9a b67a9289 c47299ba 27039ee5 dd555e14 839018d8 aabbd9c9 d78fc632
fff4b3a7 40000096 7f466aac fffffbc0 5f4016d2 5f4016d0 12e2b0 f4307f87
H 95b5621c ca62817a a48dacd8 6d2b54bf
M2
6377448b d9e59f18 f2aa3cbb d6cb92ba ee544a44 879fa576 1ca34633 76ca5d4f
a67a8a42 8d3adc8b b6e3d814 5630998d 86ea5dcd a739ae7b 54fd8e32 acbb2b36
38183c9a b67a9289 c47299b2 27039ee5 dd555e14 839018d8 aabbd9c9 d78fc632
fff4b3a7 40000096 7f466aac fffffbc0 5f4016d2 5f4016d0 12e2b0 f5b16963

6377488b d9e59f18 f2aa3cbb d6cb92ba ee544a44 879fa576 1ca34633 76ca5d4f
a67a8a42 8d3adc8b b6e3d814 d630998d 86ea5dcd a739ae7b 54fd8e32 acbb2b36
38183c9a b67a9289 c47299ba 27039ee5 dd555e14 839018d8 aabbd9c9 d78fc632
fff4b3a7 40000096 7f466aac fffffbc0 5f4016d2 5f4016d0 12e2b0 f5b16963
H b0e99492 d64eb647 5149ef30 4293733c
Table 2 Two pairs of collision, where i=11 and these two examples differ only at the last word
3 Collisions for MD4
MD4 is designed by R. L. Rivest[8] . Attack of H. Dobbertin in Eurocrypto'96[2] can find collision with
probability 1/222. Our attack can find collision with hand calculation, such that
) 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 2 , 2 , 0 ( , 16 31 28 31 C C M M
and ) ( 4 ) ( 4 M MD M MD .
M1
4d7a9c83 56cb927a b9d5a578 57a7a5ee de748a3c dcc366b3 b683a020 3b2a5d9f
c69d71b3 f9e99198 d79f805e a63bb2e8 45dd8e31 97e31fe5 2794bf08 b9e8c3e9
M1
4d7a9c83 d6cb927a 29d5a578 57a7a5ee de748a3c dcc366b3 b683a020 3b2a5d9f
c69d71b3 f9e99198 d79f805e a63bb2e8 45dc8e31 97e31fe5 2794bf08 b9e8c3e9
H 5f5c1a0d 71b36046 1b5435da 9b0d807a
M2
4d7a9c83 56cb927a b9d5a578 57a7a5ee de748a3c dcc366b3 b683a020 3b2a5d9f
c69d71b3 f9e99198 d79f805e a63bb2e8 45dd8e31 97e31fe5 f713c240 a7b8cf69

4d7a9c83 d6cb927a 29d5a578 57a7a5ee de748a3c dcc366b3 b683a020 3b2a5d9f
c69d71b3 f9e99198 d79f805e a63bb2e8 45dc8e31 97e31fe5 f713c240 a7b8cf69
H e0f76122 c429c56c ebb5e256 b809793
Table 3 Two pairs of collisions for MD4
4 Collisions for RIPEMD
RIPEMD was developed for the RIPE project (RACE Integrrity Primitives Evalustion, 1988-1992). In
1995, H. Dobbertin proved that the reced version RIPEMD with two rounds is not collision-free[4]. We show
that the full RIPEMD also isnOt collision-free. The following are two pairs of collisions for RIPEMD:
) 2 , 0 , 0 , 0 , 0 , 2 2 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 ( , 31 31 18 20 ' C C M M i i
M1
579faf8e 9ecf579 574a6aba 78413511 a2b410a4 ad2f6c9f b56202c 4d757911
bdeaae7 78bc91f2 47bc6d7d 9abdd1b1 a45d2015 817104ff 264758a8 61064ea5
M1
579faf8e 9ecf579 574a6aba 78513511 a2b410a4 ad2f6c9f b56202c 4d757911
bdeaae7 78bc91f2 c7c06d7d 9abdd1b1 a45d2015 817104ff 264758a8 e1064ea5
H 1fab152 1654a31b 7a33776a 9e968ba7
M2
579faf8e 9ecf579 574a6aba 78413511 a2b410a4 ad2f6c9f b56202c 4d757911
bdeaae7 78bc91f2 47bc6d7d 9abdd1b1 a45d2015 a0a504ff b18d58a8 e70c66b6

579faf8e 9ecf579 574a6aba 78513511 a2b410a4 ad2f6c9f b56202c 4d757911
bdeaae7 78bc91f2 c7c06d7d 9abdd1b1 a45d2015 a0a504ff b18d58a8 670c66b6
H 1f2c159f 569b31a6 dfcaa51a 25665d24
Table 4 The collisions for RIPEMD
5 Remark
Besides the above hash functions we break, there are some other hash functions not having ideal security. For
example, collision of SHA-0 [6] can be found with about 240 computations of SHA-0 algorithms, and a collision
for HAVAL-160 can be found with probability 1/232.
Note that the messages and all other values in this paper are composed of 32-bit words, in each 32-bit word
the most left byte is the most significant byte.
1 B. den Boer, Antoon Bosselaers, Collisions for the Compression Function of MD5, Eurocrypto,93.
2 H. Dobbertin, Cryptanalysis of MD4, Fast Software Encryption, LNCS 1039, D. , Springer-Verlag, 1996.
3 H. Dobbertin, Cryptanalysis of MD5 compress, presented at the rump session of EurocrZpt'96.
4 Hans Dobbertin, RIPEMD with Two-round Compress Function is Not Collision-Free, J. Cryptology 10(1),
1997.
5 H. Dobbertin, A. Bosselaers, B. Preneel, "RIPMEMD-160: A Strengthened Version of RIPMMD," Fast
Software EncrZption, LNCS 1039, D.Gollmann, Ed., Springer-Verlag, 1996, pp. 71-82.
6 FIPS 180-1, Secure hash standard, NIST, US Department of Commerce, Washington D. C., April 1995.
7 P. R. Kasselman, W T Penzhorn , Cryptananlysis od reced version of HAVAL, Vol. 36, No. 1, Electronic
Letters, 2000.
8 R. L. Rivest, The MD4 Message Digest Algorithm, Request for Comments (RFC)1320, Internet Activities
Board, Internet Privacy Task Force, April 1992.
9 R. L Rivest, The MD5 Message Digest Algorithm, Request for Comments (RFC)1321, Internet Activities
Board, Internet PrivacZ Task Force, April 1992.3RIPEMD-1281
10 Y. Zheng, J. Pieprzyk, J. Seberry, HAVAL--A One-way Hashing Algorithm with Variable Length of Output,
Auscrypto'92.

熱點內容
一萬級凈化車間有哪些配置 發布:2025-05-15 12:16:41 瀏覽:97
javazip解壓加密 發布:2025-05-15 12:15:02 瀏覽:941
dnf伺服器存放什麼信息 發布:2025-05-15 12:11:07 瀏覽:216
辦公室視頻劇本腳本 發布:2025-05-15 12:03:51 瀏覽:490
編譯失敗什麼意思 發布:2025-05-15 11:58:18 瀏覽:87
lcs腳本官網 發布:2025-05-15 11:56:15 瀏覽:88
三國志戰略版打9級礦什麼配置 發布:2025-05-15 11:41:29 瀏覽:953
安卓加速器怎麼關 發布:2025-05-15 11:38:16 瀏覽:465
密碼鎖壞了如何打開 發布:2025-05-15 11:30:19 瀏覽:838
怎樣增加共享文件夾連接數量 發布:2025-05-15 11:24:50 瀏覽:962