當前位置:首頁 » 密碼管理 » cmd5加密解密代碼

cmd5加密解密代碼

發布時間: 2023-01-22 08:45:06

㈠ Asp.net的MD5加密,可怎麼解密呢(C#)

史上MD5解密之最快方法整理-md5在線加密解密一般來說,形如1e4dc79d489e86b2的16位或者32位密碼就是經過MD5加密的,(當然也有特殊,比如DVBBS在登陸時候會先產生一個16位的隨機密碼,當然,這個密碼還是和MD5密碼的形式有點區別,相同的是都是16位的數字+字母組合 。); 這個一般來說可以用一個叫dv.exe的工具來破解。他可以破解加密前是10位以下的純數字或者純字母,破解純數字的,速度超快,但是純字母的,就慢了,當然他還有其他功能,但是其他功能沒什麼特別之處,所以不說。 破解純數字時候:dv -p a.txt -b num 純字母: dv -p a.txt -b char [以上的兩a.txt是保存要破解的密碼存放的文件,存放格式是每行一組,例如: 1e4dc79d489e86b2 admin 1e4dc79d489e86b3 admin2 注意:在要破解的密碼和後面的admin 用戶名之間有一個空格。 當然還有很多字典破解 的工具,不建議使用。 還有就是有很多網站提供MD5密碼查詢,比如: http://www.md5lookup.com/?category=01-3&searck=on http://www.md5.org.cn http://www.xmd5.org/ http://www.milw0rm.com/md5/info.php http://www.neeao.com/md5/ http://md5.mmkey.com/ http://gdataonline.com/seekhash.php http://www.plain-text.info/search.php http://passcracking.com/Good_values_list.asp http://www.hashchecker.com/index.php?_sls=search_hash http://md5.rednoize.com/ http://us.md5.crysm.net/ http://uploadpage.net/ap/php/projects/rt/addhash.php http://www.cmd5.com 這個是我經常用的 http://www.md5lookup.com/ (對數字破解比較好) http://md5.rednoize.com/ (對字母破解比較好) http://nz.md5.crysm.net/ (從1到4位數字)- 好像關了 http://us.md5.crysm.net/ (美英字典的破解收集和IP地址) http://www.xmd5.org/ (對數字破解比較好) http://gdataonline.com/ (估計是基礎字典的破解) http://www.hashchecker.com/ (這個倒是說得很厲害,但是在實際中,很多次我在這里都找不到) http://passcracking.ru/ http://www.milw0rm.com/md5 http://plain-text.info/ (這個是我比較喜歡一個.也請你提交一些已破解的MD5) http://www.securitystats.com/tools/hashcrack.php (多種破解.我試過...沒有一次破解出來.非常沒用) http://www.schwett.com/md5/ - (破解挪威人(Norwegian)字典) http://passcrack.spb.ru/ http://shm.pl/md5/ http://www.und0it.com/ http://www.neeao.com/md5/ http://md5.benramsey.com/ http://www.md5decrypt.com/ http://md5.khrone.pl/ http://www.csthis.com/md5/index.php http://www.md5decrypter.com/ http://www.md5encryption.com/ http://www.md5database.net/ http://md5.xpzone.de/ http://md5.geeks.li/ http://www.hashreverse.com/ http://www.cmd5.com/english.aspx http://www.md5.altervista.org/ http://md5.overclock.ch/biz/index.php?p=md5crack&l=en http://alimamed.pp.ru/md5/ (如果你看不懂俄文,我告訴你,把你的MD5放到第2個格子) http://md5crack.it-helpnet.de/index.php?op=add (德國的....) http://cijfer.hua.fi/ (Projects->md5 reverse lookup) http://shm.hard-core.pl/md5/ http://www.mmkey.com/md5/HOME.ASP http://www.thepanicroom.org/index.php?view=cracker http://rainbowtables.net/services/results.php (我試過破過幾次在這里) http://rainbowcrack.com/ (需要捐獻) http://www.securitydb.org/cracker/ http://passwordsecuritycenter.com/index.php?main_page=proct_info&cPath=3&procts_id=7 這個是證明他們的破解商品的質量..好讓你來買這個破解程序...但是...只要能破解到即可.你又不一定要買.. http://0ptix.co.nr/md5 http://www.abcbit.com/md5/ http://mao8.com/Checkmd5.asp 前兩個是今天入侵剛用過的算是比較好使 下面的是以前搜到的,一般。 http://www.xmd5.com/index_cn.htm http://www.md5lookup.com/?category=01-3&searck=on http://www.md5.org.cn http://www.xmd5.org/ http://www.milw0rm.com/md5/info.php http://www.neeao.com/md5/ http://md5.mmkey.com/ http://gdataonline.com/seekhash.php http://www.plain-text.info/search.php http://passcracking.com/Good_values_list.asp http://www.hashchecker.com/index.php?_sls=search_hash http://md5.rednoize.com/ http://us.md5.crysm.net/ http://uploadpage.net/ap/php/projects/rt/addhash.php

㈡ 求一個簡單的md5加密程序C或C++代碼

C語言實現MD5演算法
#include<stdio.h>

#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 RL(x, y) (((x) << (y)) | ((x) >> (32 - (y)))) //x向左循環移y位

#define PP(x) (x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24) //將x高低位互換,例如PP(aabbccdd)=ddccbbaa

#define FF(a, b, c, d, x, s, ac) a = b + (RL((a + F(b,c,d) + x + ac),s))
#define GG(a, b, c, d, x, s, ac) a = b + (RL((a + G(b,c,d) + x + ac),s))
#define HH(a, b, c, d, x, s, ac) a = b + (RL((a + H(b,c,d) + x + ac),s))
#define II(a, b, c, d, x, s, ac) a = b + (RL((a + I(b,c,d) + x + ac),s))

unsigned A,B,C,D,a,b,c,d,i,len,flen[2],x[16]; //i臨時變數,len文件長,flen[2]為64位二進製表示的文件初始長度
char filename[200]; //文件名
FILE *fp;

void md5(){ //MD5核心演算法,供64輪

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

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

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

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

A += a;
B += b;
C += c;
D += d;

}

main(){
while(1){
printf("Input file:");
gets(filename); //用get函數,避免scanf以空格分割數據,
if (filename[0]==34) filename[strlen(filename)-1]=0,strcpy(filename,filename+1); //支持文件拖曳,但會多出雙引號,這里是處理多餘的雙引號
if (!strcmp(filename,"exit")) exit(0); //輸入exit退出
if (!(fp=fopen(filename,"rb"))) {printf("Can not open this file!\n");continue;} //以二進制打開文件
fseek(fp, 0, SEEK_END); //文件指針轉到文件末尾
if((len=ftell(fp))==-1) {printf("Sorry! Can not calculate files which larger than 2 GB!\n");fclose(fp);continue;} //ftell函數返回long,最大為2GB,超出返回-1
rewind(fp); //文件指針復位到文件頭
A=0x67452301,B=0xefcdab89,C=0x98badcfe,D=0x10325476; //初始化鏈接變數
flen[1]=len/0x20000000; //flen單位是bit
flen[0]=(len%0x20000000)*8;
memset(x,0,64); //初始化x數組為0
fread(&x,4,16,fp); //以4位元組為一組,讀取16組數據
for(i=0;i<len/64;i++){ //循環運算直至文件結束
md5();
memset(x,0,64);
fread(&x,4,16,fp);
}
((char*)x)[len%64]=128; //文件結束補1,補0操作,128二進制即10000000
if(len%64>55) md5(),memset(x,0,64);
memcpy(x+14,flen,8); //文件末尾加入原文件的bit長度
md5();
fclose(fp);
printf("MD5 Code:%08x%08x%08x%08x\n",PP(A),PP(B),PP(C),PP(D)); //高低位逆反輸出
}
}

㈢ CMD5現在怎麼解密

沒有辦法MD5加密不能逆序解密,網上的所謂的md5解密都是一些常見的單詞或數字,經過加密後對比得到的,並不是真正的解密,不過你真要知道的話,山東大學有一個教授把MD5加密破解了,你可以到山東大學去咨詢

㈣ c# 加密和解密代碼

加密有很多中,常用的有MD5

C# md5加密(上)
string a; //加密前數據
string b; //加密後數據
b=System.Web.Security.FormsAuthentication.(a,"MD5")
using System;
using System.Security.Cryptography;
方法2
public static string GetMD5(string myString)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] fromData = System.Text.Encoding.Unicode.GetBytes(myString);
byte[] targetData = md5.ComputeHash(fromData);
string byte2String = null;
for (int i=0; i<targetData.Length; i++)
{
byte2String += targetData[i].ToString("x");
}
return byte2String;
}
using System.Security.Cryptography;

/// <summary>
/// 給一個字元串進行MD5加密
/// </summary>
/// <param name="strText">待加密字元串</param>
/// <returns>加密後的字元串</returns>
public static string MD5Encrypt(string strText)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(System.Text.Encoding.Default.GetBytes(strText));
return System.Text.Encoding.Default.GetString(result);
}

C# MD5加密
using System.Security.Cryptography;

private void btnOK_Click(object sender, System.EventArgs e)
{
string strConn = "server=192.168.0.51;database=chengheng;User id=sa; password=123";
if(texName.Text.Trim()=="")
{
this.RegisterStartupScript("sf","<script language='javascript'>alert('用戶名不能為空');document.all('texName').focus()</script>");
return;
}
else if(texPassword.Text.Trim()=="")
{
this.RegisterStartupScript("sfs","<script language='javascript'>alert('密碼不能為空');document.all('texPassword').focus()</script>");
return;
}
else
{
//將獲取的密碼加密與資料庫中加了密的密碼相比較
byte[] by = md5.ComputeHash(utf.GetBytes(texPassword.Text.Trim()));
string resultPass = System.Text.UTF8Encoding.Unicode.GetString(by);
conn.ConnectionString=strConn;
SqlCommand comm = new SqlCommand();
string name = texName.Text.Trim().ToString();
comm.CommandText="select Ruser_pwd,Ruser_nm from Ruser where Accountno = @name";
comm.Parameters.Add("@name",SqlDbType.NVarChar,40);
comm.Parameters["@name"].Value=name;
try
{
conn.Open();
comm.Connection=conn;
SqlDataReader dr=comm.ExecuteReader();
if(dr.Read())
{
//用戶存在,對密碼進行檢查
if(dr.GetValue(0).Equals(resultPass))
{
string user_name=dr.GetValue(1).ToString();
string user_Accountno=texName.Text.Trim();
Session["logon_name"]=user_name;
Session["logon_Accountno"]=user_Accountno;
//登錄成功,進行頁面導向
}
else
{
this.RegisterStartupScript("wp","<script language='javascript'>alert('密碼錯誤,請檢查。')</script>");
}

}
else
{
this.RegisterStartupScript("nu","<script language=javascript>alert('用戶名不存在,請檢查。')</script>");
}
}
catch(Exception exec)
{
this.RegisterStartupScript("wc","<script language=javascript>alert('網路連接有異,請稍後重試。')</script>");
}
finally
{
conn.Close();
}
}
}

㈤ 急求 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;
}

㈥ 求助cmd5密文解密

這個密文解開就是:xiaomayi 要看dll加的是什麼密文,有些對。有些不對。不過一般是官方的那個密碼

㈦ C語言 MD5加密

main.cpp

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include "md5.c"

int main(int argc, char* argv[])

{

int i;

unsigned char encrypt[] = "admin";//

unsigned char decrypt[16];

MD5_CTX md5;

MD5Init(&md5);

MD5Update(&md5, encrypt, strlen((char*)encrypt));

MD5Final(&md5, decrypt);

printf("加密前:%s\n加密後:", encrypt);

for (i = 0; i < 16; i++)

{

printf("%02x", decrypt[i]);

}

getchar();

return 0;

}

md5.c

#include <memory.h>

#include "md5.h"

unsigned char PADDING[] = { 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 };

void MD5Init(MD5_CTX* context)

{

    context->count[0] = 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 = 0, index = 0, partlen = 0;

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

    partlen = 64 - index;

    context->count[0] += inputlen << 3;

    if (context->count[0] < (inputlen << 3))

        context->count[1]++;

    context->count[1] += inputlen >> 29;

    if (inputlen >= partlen)

    {

        memcpy(&context->buffer[index], input, partlen);

        MD5Transform(context->state, context->buffer);

        for (i = partlen; i + 64 <= inputlen; i += 64)

            MD5Transform(context->state, &input[i]);

        index = 0;

    }

    else

    {

        i = 0;

    }

    memcpy(&context->buffer[index], &input[i], inputlen - i);

}

void MD5Final(MD5_CTX* context, unsigned char digest[16])

{

    unsigned int index = 0, padlen = 0;

    unsigned char bits[8];

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

    padlen = (index < 56) ? (56 - index) : (120 - index);

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

    MD5Update(context, PADDING, padlen);

    MD5Update(context, bits, 8);

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

}

void MD5Encode(unsigned char* output, unsigned int* input, unsigned int len)

{

    unsigned int i = 0, j = 0;

    while (j < len)

    {

        output[j] = input[i] & 0xFF;

        output[j + 1] = (input[i] >> 8) & 0xFF;

        output[j + 2] = (input[i] >> 16) & 0xFF;

        output[j + 3] = (input[i] >> 24) & 0xFF;

        i++;

        j += 4;

    }

}

void MD5Decode(unsigned int* output, unsigned char* input, unsigned int len)

{

    unsigned int i = 0, j = 0;

    while (j < len)

    {

        output[i] = (input[j]) |

            (input[j + 1] << 8) |

            (input[j + 2] << 16) |

            (input[j + 3] << 24);

        i++;

        j += 4;

    }

}

void MD5Transform(unsigned int state[4], unsigned char block[64])

{

    unsigned int a = state[0];

    unsigned int b = state[1];

    unsigned int c = state[2];

    unsigned int d = state[3];

    unsigned int x[64];

    MD5Decode(x, block, 64);

    FF(a, b, c, d, x[0], 7, 0xd76aa478); /* 1 */

    FF(d, a, b, c, x[1], 12, 0xe8c7b756); /* 2 */

    FF(c, d, a, b, x[2], 17, 0x242070db); /* 3 */

    FF(b, c, d, a, x[3], 22, 0xc1bdceee); /* 4 */

    FF(a, b, c, d, x[4], 7, 0xf57c0faf); /* 5 */

    FF(d, a, b, c, x[5], 12, 0x4787c62a); /* 6 */

    FF(c, d, a, b, x[6], 17, 0xa8304613); /* 7 */

    FF(b, c, d, a, x[7], 22, 0xfd469501); /* 8 */

    FF(a, b, c, d, x[8], 7, 0x698098d8); /* 9 */

    FF(d, a, b, c, x[9], 12, 0x8b44f7af); /* 10 */

    FF(c, d, a, b, x[10], 17, 0xffff5bb1); /* 11 */

    FF(b, c, d, a, x[11], 22, 0x895cd7be); /* 12 */

    FF(a, b, c, d, x[12], 7, 0x6b901122); /* 13 */

    FF(d, a, b, c, x[13], 12, 0xfd987193); /* 14 */

    FF(c, d, a, b, x[14], 17, 0xa679438e); /* 15 */

    FF(b, c, d, a, x[15], 22, 0x49b40821); /* 16 */

    /* Round 2 */

    GG(a, b, c, d, x[1], 5, 0xf61e2562); /* 17 */

    GG(d, a, b, c, x[6], 9, 0xc040b340); /* 18 */

    GG(c, d, a, b, x[11], 14, 0x265e5a51); /* 19 */

    GG(b, c, d, a, x[0], 20, 0xe9b6c7aa); /* 20 */

    GG(a, b, c, d, x[5], 5, 0xd62f105d); /* 21 */

    GG(d, a, b, c, x[10], 9, 0x2441453); /* 22 */

    GG(c, d, a, b, x[15], 14, 0xd8a1e681); /* 23 */

    GG(b, c, d, a, x[4], 20, 0xe7d3fbc8); /* 24 */

    GG(a, b, c, d, x[9], 5, 0x21e1cde6); /* 25 */

    GG(d, a, b, c, x[14], 9, 0xc33707d6); /* 26 */

    GG(c, d, a, b, x[3], 14, 0xf4d50d87); /* 27 */

    GG(b, c, d, a, x[8], 20, 0x455a14ed); /* 28 */

    GG(a, b, c, d, x[13], 5, 0xa9e3e905); /* 29 */

    GG(d, a, b, c, x[2], 9, 0xfcefa3f8); /* 30 */

    GG(c, d, a, b, x[7], 14, 0x676f02d9); /* 31 */

    GG(b, c, d, a, x[12], 20, 0x8d2a4c8a); /* 32 */

    /* Round 3 */

    HH(a, b, c, d, x[5], 4, 0xfffa3942); /* 33 */

    HH(d, a, b, c, x[8], 11, 0x8771f681); /* 34 */

    HH(c, d, a, b, x[11], 16, 0x6d9d6122); /* 35 */

    HH(b, c, d, a, x[14], 23, 0xfde5380c); /* 36 */

    HH(a, b, c, d, x[1], 4, 0xa4beea44); /* 37 */

    HH(d, a, b, c, x[4], 11, 0x4bdecfa9); /* 38 */

    HH(c, d, a, b, x[7], 16, 0xf6bb4b60); /* 39 */

    HH(b, c, d, a, x[10], 23, 0xbebfbc70); /* 40 */

    HH(a, b, c, d, x[13], 4, 0x289b7ec6); /* 41 */

    HH(d, a, b, c, x[0], 11, 0xeaa127fa); /* 42 */

    HH(c, d, a, b, x[3], 16, 0xd4ef3085); /* 43 */

    HH(b, c, d, a, x[6], 23, 0x4881d05); /* 44 */

    HH(a, b, c, d, x[9], 4, 0xd9d4d039); /* 45 */

    HH(d, a, b, c, x[12], 11, 0xe6db99e5); /* 46 */

    HH(c, d, a, b, x[15], 16, 0x1fa27cf8); /* 47 */

    HH(b, c, d, a, x[2], 23, 0xc4ac5665); /* 48 */

    /* Round 4 */

    II(a, b, c, d, x[0], 6, 0xf4292244); /* 49 */

    II(d, a, b, c, x[7], 10, 0x432aff97); /* 50 */

    II(c, d, a, b, x[14], 15, 0xab9423a7); /* 51 */

    II(b, c, d, a, x[5], 21, 0xfc93a039); /* 52 */

    II(a, b, c, d, x[12], 6, 0x655b59c3); /* 53 */

    II(d, a, b, c, x[3], 10, 0x8f0ccc92); /* 54 */

    II(c, d, a, b, x[10], 15, 0xffeff47d); /* 55 */

    II(b, c, d, a, x[1], 21, 0x85845dd1); /* 56 */

    II(a, b, c, d, x[8], 6, 0x6fa87e4f); /* 57 */

    II(d, a, b, c, x[15], 10, 0xfe2ce6e0); /* 58 */

    II(c, d, a, b, x[6], 15, 0xa3014314); /* 59 */

    II(b, c, d, a, x[13], 21, 0x4e0811a1); /* 60 */

    II(a, b, c, d, x[4], 6, 0xf7537e82); /* 61 */

    II(d, a, b, c, x[11], 10, 0xbd3af235); /* 62 */

    II(c, d, a, b, x[2], 15, 0x2ad7d2bb); /* 63 */

    II(b, c, d, a, x[9], 21, 0xeb86d391); /* 64 */

    state[0] += a;

    state[1] += b;

    state[2] += c;

    state[3] += d;

}

md5.h

#ifndef MD5_H

#define MD5_H

typedef struct

{

    unsigned int count[2];

    unsigned int state[4];

    unsigned char buffer[64];

}MD5_CTX;

#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 + ac; \

          a = ROTATE_LEFT(a,s); \

          a += b; \

          }

#define GG(a,b,c,d,x,s,ac) \

          { \

          a += G(b,c,d) + x + ac; \

          a = ROTATE_LEFT(a,s); \

          a += b; \

          }

#define HH(a,b,c,d,x,s,ac) \

          { \

          a += H(b,c,d) + x + ac; \

          a = ROTATE_LEFT(a,s); \

          a += b; \

          }

#define II(a,b,c,d,x,s,ac) \

          { \

          a += I(b,c,d) + x + 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(MD5_CTX* context, unsigned char digest[16]);

void MD5Transform(unsigned int state[4], unsigned char block[64]);

void MD5Encode(unsigned char* output, unsigned int* input, unsigned int len);

void MD5Decode(unsigned int* output, unsigned char* input, unsigned int len);

#endif

㈧ asp中用md5演算法得到的加密數據如何解密!麻煩寫個簡單的代碼演示下!

MD5 是破壞性加密,也就是說是無法由密文直接解密的。

詳細說明如下:

MD5是輸入不定長度訊息,輸出固定長度128-bits的演演算法。經過程式流程,生成四個32位元資料,最後聯合起來成為一個128-bits雜湊。基本方式為,求余、取余、調整長度、與連結變數進行迴圈運算。得出結果。一般128位元的MD5雜湊被表示為32位元十六進制數位。以下是一個43位長ASCII字母列的MD5雜湊:
MD5("The quick brown fox jumps over the lazy dog") =
即使在原文中作一個小變化(比如用c取代d)其雜湊也會發生巨大的變化:
MD5("The quick brown fox jumps over the lazy cog") =
而空文的雜湊為:
MD5("") =

MD5的弱點:

MD5較老,雜湊長度通常為128位元,隨著電腦運算能力提高,找到「碰撞」是可能的。因此,在安全要求高的場合不使用MD5。
2004年,王小雲證明MD5數位簽名演演算法可以產生碰撞。
2007年,Marc Stevens,Arjen K. Lenstra和Benne de Weger進一步指出透過偽造軟體簽名,可重復性攻擊MD5演演算法。研究者使用字首碰撞法(chosen-prefix collision),使程式前端包含惡意程式,利用後面的空間添上垃圾代碼湊出同樣的MD5 Hash值。
2007年,荷蘭埃因霍芬技術大學科學家成功把2個執行檔進行了MD5碰撞,使得這兩個執行結果不同的程式被計算出同一個MD5。
2008年12月一組科研人員透過MD5碰撞成功生成了偽造的SSL證書,這使得在https協議中伺服器可以偽造一些根CA的簽名。

熱點內容
shell腳本的for 發布:2025-08-26 03:33:46 瀏覽:685
骨關節廣告腳本 發布:2025-08-26 03:18:13 瀏覽:669
免費java培訓 發布:2025-08-26 03:13:49 瀏覽:752
iphone軟體存儲滿 發布:2025-08-26 03:08:26 瀏覽:994
misc是什麼文件夾 發布:2025-08-26 02:49:03 瀏覽:344
緩存視頻最快的軟體 發布:2025-08-26 02:45:11 瀏覽:157
android卡刷 發布:2025-08-26 02:42:41 瀏覽:314
db2查看資料庫字元集 發布:2025-08-26 02:42:34 瀏覽:33
sql2008隨機數 發布:2025-08-26 02:37:48 瀏覽:343
做個電商網站需要什麼伺服器 發布:2025-08-26 02:37:42 瀏覽:268