| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1636 人关注过本帖
标题:[讨论] 谁有MD5反加密代码?
只看楼主 加入收藏
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
 问题点数:0 回复次数:11 
[讨论] 谁有MD5反加密代码?
如题!
搜索更多相关主题的帖子: 代码 讨论 
2006-03-09 10:11
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

这个目前没人有呢,MD5一般只能加密不能反加密。

2006-03-09 10:45
witer
Rank: 1
等 级:新手上路
帖 子:165
专家分:0
注 册:2006-2-7
收藏
得分:0 
不过可以通过软件对密码进行反编译得到原来的密码值!
2006-03-09 17:03
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
得分:0 

那有什么加密代码可加密也可以反加密


2006-03-09 17:13
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
得分:0 

我顶一下


2006-03-10 08:33
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
RC4算法

<HEAD>
<META HTTP-EQUIV="Content-Language" CONTENT="zh-cn">
</HEAD>

<%
key="sdfjal;dfjaoiejojfafnsanf;aufweijoanfanfaieufowejrwnf;aupagyuweranfsajfagfuoag" '私钥

Sub RC4Initialize(strPwd,ByRef sbox,ByRef key)

dim tempSwap
dim a
dim b

intLength = len(strPwd)
For a = 0 To 255
key(a) = asc(mid(strpwd, (a mod intLength)+1, 1))
sbox(a) = a
next

b = 0
For a = 0 To 255
b = (b + sbox(a) + key(a)) Mod 256
tempSwap = sbox(a)
sbox(a) = sbox(b)
sbox(b) = tempSwap
Next

End Sub

Function EnCrypt(plaintxt, psw)
Dim sbox(255)
Dim key(255)

dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher

i = 0
j = 0

RC4Initialize psw,sbox,key

For a = 1 To Len(plaintxt)

i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp

k = sbox((sbox(i) + (sbox(j) Mod 256)) Mod 256)

cipherby = asc(Mid(plaintxt, a, 1)) Xor k

cipher = cipher & "&#"&cipherby&";" 'eg: &#128;

Next
EnCrypt = cipher
End Function

Function DeCrypt(cryptxt, psw)
Dim sbox(255)
Dim key(255)

dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher

i = 0
j = 0

RC4Initialize psw,sbox,key

crypchar=split(cryptxt,";",-1,1) '将密文拆分成每个密文字符放入数组crypchar,但是每个数组元素少一个分号“;”
crypttxtlen=Ubound(crypchar) '返回数组的个数,即加密字符的个数+1(数组中最后一个元素为空)

For a = 1 To crypttxtlen
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp

k = sbox((sbox(i) + (sbox(j) Mod 256)) Mod 256)

tmpcryptxt=mid(crypchar(i-1),3)
cipherby = tmpcryptxt Xor k

cipher = cipher & "&#"&cipherby&";" 'eg: &#128;
Next

DeCrypt = cipher
End Function

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
plaintext=request.form("plaintext")
response.write "<br>输入的明文字符串是:"&plaintext
cryptext=EnCrypt(plaintext,key)
response.write "<br>加密后的密文字符串:" &cryptext
decryptext=DeCrypt(cryptext,key)
response.write "<br>解密输出的字符串是:" &decryptext
end if
%>

<title>RC4加密算法模拟</title>
<FORM METHOD="POST" ACTION="index.asp">
<P>请输入需要加密的明文:<INPUT TYPE="text" NAME="plaintext" SIZE="20">
</P>
<P>
<INPUT TYPE="submit" VALUE="进行加密" NAME="B1">
<INPUT TYPE="reset" VALUE="重新输入" NAME="B2"></P>
</FORM>

[此贴子已经被作者于2006-3-10 8:41:25编辑过]


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2006-03-10 08:41
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
RSA算法

index.asp

<!--#INCLUDE FILE="RSA.asp"-->
<title>RSA加密算法模拟</title>
<%
function Encryptstr(Message)
Dim LngKeyE
Dim LngKeyD
Dim LngKeyN
Dim StrMessage
Dim ObjRSA

LngKeyE = "32823"
LngKeyD = "20643"
LngKeyN = "29893"
StrMessage = Message

Set ObjRSA = New clsRSA

ObjRSA.PublicKey = LngKeyE
ObjRSA.Modulus = LngKeyN
Encryptstr = ObjRSA.Encode(StrMessage)
Set ObjRSA = Nothing
end function

function decryptstr(Message)
Dim LngKeyE
Dim LngKeyD
Dim LngKeyN
Dim StrMessage
Dim ObjRSA


LngKeyE = "32823"
LngKeyD = "20643"
LngKeyN = "29893"
StrMessage = Message

Set ObjRSA = New clsRSA

ObjRSA.PrivateKey =LngKeyD
ObjRSA.Modulus=LngKeyN
decryptstr=ObjRSA.Decode(StrMessage)
Set ObjRSA = Nothing
end function

dim last,first
first="china"
Response.Write "<br>加密前为:"&first
last=Encryptstr(first)
Response.Write "<br>加密后为:"&last
Response.Write "<br>解密后为:" &decryptstr(last)

%>

==================================================================================
rsa.asp

<%
rem 在ASP中实现加密与解密,加密方法:根据RSA
Class clsRSA

Public PrivateKey
Public PublicKey
Public Modulus



Public Function Crypt(pLngMessage, pLngKey)
On Error Resume Next
Dim lLngMod
Dim lLngResult
Dim lLngIndex
If pLngKey Mod 2 = 0 Then
lLngResult = 1
For lLngIndex = 1 To pLngKey / 2
lLngMod = (pLngMessage ^ 2) Mod Modulus
' Mod may error on key generation
lLngResult = (lLngMod * lLngResult) Mod Modulus
If Err Then Exit Function
Next
Else
lLngResult = pLngMessage
For lLngIndex = 1 To pLngKey / 2
lLngMod = (pLngMessage ^ 2) Mod Modulus
On Error Resume Next
' Mod may error on key generation
lLngResult = (lLngMod * lLngResult) Mod Modulus
If Err Then Exit Function
Next
End If
Crypt = lLngResult
End Function

Public Function Encode(ByVal pStrMessage)
Dim lLngIndex
Dim lLngMaxIndex
Dim lBytAscii
Dim lLngEncrypted
lLngMaxIndex = Len(pStrMessage)
If lLngMaxIndex = 0 Then Exit Function
For lLngIndex = 1 To lLngMaxIndex
lBytAscii = Asc(Mid(pStrMessage, lLngIndex, 1))
lLngEncrypted = Crypt(lBytAscii, PublicKey)
Encode = Encode & NumberToHex(lLngEncrypted, 4)
Next
End Function

Public Function Decode(ByVal pStrMessage)
Dim lBytAscii
Dim lLngIndex
Dim lLngMaxIndex
Dim lLngEncryptedData
Decode = ""
lLngMaxIndex = Len(pStrMessage)
For lLngIndex = 1 To lLngMaxIndex Step 4
lLngEncryptedData = HexToNumber(Mid(pStrMessage, lLngIndex, 4))
lBytAscii = Crypt(lLngEncryptedData, PrivateKey)
Decode = Decode & Chr(lBytAscii)
Next
End Function

Private Function NumberToHex(ByRef pLngNumber, ByRef pLngLength)
NumberToHex = Right(String(pLngLength, "0") & Hex(pLngNumber), pLngLength)
End Function

Private Function HexToNumber(ByRef pStrHex)
HexToNumber = CLng("&h" & pStrHex)
End Function

End Class
%>


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2006-03-10 08:44
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
上面这两中方法都可反解,但从安全考虑,楼住还是自己编写比较好,那怕最简单的加密也能有很好的做用

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2006-03-10 08:46
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
Base64 算法

<title>Base64加密算法模拟</title>
<!--Base64编码要求把3个8位字节(3*8=24)转化为4个6位的字节(4*6=24),之后在6位的前面补两个0,形成8位一个字节的形式。-->
<%
sBASE_64_CHARACTERS = "Iz01BScostuDEKxT9WvM23LQh+/NeFGHklijUV678mnw4JApqrXOPdYZaRfgbCy5" '64个不重复的字符
sBASE_64_CHARACTERS = strUnicode2Ansi(sBASE_64_CHARACTERS)

Function strUnicodeLen(asContents)
'计算unicode字符串的Ansi编码的长度
asContents1="a"&asContents
len1=len(asContents1)
k=0
for i=1 to len1
asc1=asc(mid(asContents1,i,1))
if asc1<0 then asc1=65536+asc1
if asc1>255 then
k=k+2
else
k=k+1
end if
next
strUnicodeLen=k-1
End Function

Function strUnicode2Ansi(asContents)
'将Unicode编码的字符串,转换成Ansi编码的字符串
strUnicode2Ansi=""
len1=len(asContents)
for i=1 to len1
varchar=mid(asContents,i,1)
varasc=asc(varchar)
if varasc<0 then varasc=varasc+65536
if varasc>255 then
varHex=Hex(varasc)
varlow=left(varHex,2)
varhigh=right(varHex,2)
strUnicode2Ansi=strUnicode2Ansi & chrb("&H" & varlow ) & chrb("&H" & varhigh )
else
strUnicode2Ansi=strUnicode2Ansi & chrb(varasc)
end if
next
End function

Function strAnsi2Unicode(asContents)
'将Ansi编码的字符串,转换成Unicode编码的字符串
strAnsi2Unicode = ""
len1=lenb(asContents)
if len1=0 then exit function
for i=1 to len1
varchar=midb(asContents,i,1)
varasc=ascb(varchar)
if varasc > 127 then
strAnsi2Unicode = strAnsi2Unicode & chr(ascw(midb(asContents,i+1,1) & varchar))
i=i+1
else
strAnsi2Unicode = strAnsi2Unicode & chr(varasc)
end if
next
End function

Function Base64encode(asContents)
'将Ansi编码的字符串进行Base64编码
'asContents应当是ANSI编码的字符串(二进制的字符串也可以)
Dim lnPosition
Dim lsResult
Dim Char1
Dim Char2
Dim Char3
Dim Char4
Dim Byte1
Dim Byte2
Dim Byte3
Dim SaveBits1
Dim SaveBits2
Dim lsGroupBinary
Dim lsGroup64
Dim m4,len1,len2

len1=Lenb(asContents)
if len1<1 then
Base64encode=""
exit Function
end if

m3=Len1 Mod 3
If M3 > 0 Then asContents = asContents & String(3-M3, chrb(0))
'补足位数是为了便于计算

IF m3 > 0 THEN
len1=len1+(3-m3)
len2=len1-3
else
len2=len1
end if

lsResult = ""

For lnPosition = 1 To len2 Step 3
lsGroup64 = ""
lsGroupBinary = Midb(asContents, lnPosition, 3)

Byte1 = Ascb(Midb(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3
Byte2 = Ascb(Midb(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15
Byte3 = Ascb(Midb(lsGroupBinary, 3, 1))

Char1 = Midb(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1)
Char2 = Midb(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
Char3 = Midb(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)
Char4 = Midb(sBASE_64_CHARACTERS, (Byte3 And 63) + 1, 1)
lsGroup64 = Char1 & Char2 & Char3 & Char4

lsResult = lsResult & lsGroup64
Next

'处理最后剩余的几个字符
if M3 > 0 then
lsGroup64 = ""
lsGroupBinary = Midb(asContents, len2+1, 3)

Byte1 = Ascb(Midb(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3
Byte2 = Ascb(Midb(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15
Byte3 = Ascb(Midb(lsGroupBinary, 3, 1))

Char1 = Midb(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1)
Char2 = Midb(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
Char3 = Midb(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)

if M3=1 then
lsGroup64 = Char1 & Char2 & ChrB(61) & ChrB(61) '用=号补足位数
else
lsGroup64 = Char1 & Char2 & Char3 & ChrB(61) '用=号补足位数
end if

lsResult = lsResult & lsGroup64
end if

Base64encode = lsResult

End Function


Function Base64decode(asContents)
'将Base64编码字符串转换成Ansi编码的字符串
'asContents应当也是ANSI编码的字符串(二进制的字符串也可以)
Dim lsResult
Dim lnPosition
Dim lsGroup64, lsGroupBinary
Dim Char1, Char2, Char3, Char4
Dim Byte1, Byte2, Byte3
Dim M4,len1,len2

len1= Lenb(asContents)
M4 = len1 Mod 4

if len1 < 1 or M4 > 0 then
'字符串长度应当是4的倍数
Base64decode = ""
exit Function
end if

'判断最后一位是不是 = 号
'判断倒数第二位是不是 = 号
'这里m4表示最后剩余的需要单独处理的字符个数
if midb(asContents, len1, 1) = chrb(61) then m4=3
if midb(asContents, len1-1, 1) = chrb(61) then m4=2

if m4 = 0 then
len2=len1
else
len2=len1-4
end if

For lnPosition = 1 To Len2 Step 4
lsGroupBinary = ""
lsGroup64 = Midb(asContents, lnPosition, 4)
Char1 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 1, 1)) - 1
Char2 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 2, 1)) - 1
Char3 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 3, 1)) - 1
Char4 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 4, 1)) - 1
Byte1 = Chrb(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
Byte2 = lsGroupBinary & Chrb(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
Byte3 = Chrb((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
lsGroupBinary = Byte1 & Byte2 & Byte3

lsResult = lsResult & lsGroupBinary
Next

'处理最后剩余的几个字符
if M4 > 0 then
lsGroupBinary = ""
lsGroup64 = Midb(asContents, len2+1, m4) & chrB(65) 'chr(65)=A,转换成值为0
if M4=2 then '补足4位,是为了便于计算
lsGroup64 = lsGroup64 & chrB(65)
end if
Char1 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 1, 1)) - 1
Char2 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 2, 1)) - 1
Char3 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 3, 1)) - 1
Char4 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 4, 1)) - 1
Byte1 = Chrb(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
Byte2 = lsGroupBinary & Chrb(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
Byte3 = Chrb((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))

if M4=2 then
lsGroupBinary = Byte1
elseif M4=3 then
lsGroupBinary = Byte1 & Byte2
end if

lsResult = lsResult & lsGroupBinary
end if

Base64decode = lsResult

End Function

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
plaintext=request.form("plaintext")
response.write "<br>输入的明文是:"&plaintext

cryptext=Base64encode(plaintext)
response.write "<br>加密的密文是:" &cryptext

decryptext=Base64decode(cryptext)
response.write "<br>解密的明文是:" &decryptext

end if

%><FORM METHOD="POST" ACTION="index.asp">
<P>请输入需要加密的明文:<INPUT TYPE="text" NAME="plaintext" SIZE="20">
</P>
<P>
<INPUT TYPE="submit" VALUE="进行加密" NAME="B1">
<INPUT TYPE="reset" VALUE="重新输入" NAME="B2"></P>
</FORM>


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2006-03-10 09:04
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
收藏
得分:0 
阳光白雪对加密这么有研究..真强..

面朝大海,春暖花开!
2006-03-10 09:20
快速回复:[讨论] 谁有MD5反加密代码?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036913 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved