【3.A.S.T】网络安全爱好者's Archiver

黑客学习

柔肠寸断 发表于 2009-4-19 21:52

关于国内某知名大学网站加密算法的研究

原创作者:柔肠寸断 [3.A.S.T]  [url]http://www.3ast.com.cm[/url] slc P E*yJ-R3W
原始出处:[url]http://www.3ast.com.cm[/url]tB:N#lv@ce
$b#c,OruOwWf.M
看不懂的直接绕过&k&Y*k6]iN9WVQ2fL"z'R
加密前为:hwy123456
.}mn8j+sQ 加密后为0F9C1C7A2EE76EBB5C1F4D7526CC4F883F4EEh*Z%HZ1y/R_

D'X]E5A ============================================
'[ x)]"WAtq 上面是当时自己校内的心情。现在已经解破出来了,分享给大家p"Rn(Ad o5dsv8f#C3|
也就不隐瞒大家什么了,这个是国内某知名大学的后台加密算法#^9][RH va;X
以下是RSA算法文件 L(g#z|2bgu @n5A&H

rj`N%k.oC 文件名RSA.ASPcb5S r6a~'X
===============================================[[5R(]M'U
<% GP)a j#ML
Class clsRSA
['[x$}"_Cxd/Rq Public PrivateKey `8mR5v2R*i
Public PublicKey
o7p j7p9vB&PJ)Q%k Public Modulus O&nv _/@R6JS4p
Public Function Crypt(pLngMessage, pLngKey)
n5[4pw&zKz On Error Resume Next 2x&uI;ITQ
Dim lLngMod
K(JQ"y'q"I Dim lLngResult $OZ._0u&j*s|O.K
Dim lLngIndex
Yeh M B)Z If pLngKey Mod 2 = 0 Then w(l,c5^xoX
lLngResult = 1
O%T$np ^*^ For lLngIndex = 1 To pLngKey / 2
cJx2P,~|D lLngMod = (pLngMessage ^ 2) Mod Modulus 8x kp \r&Ej3H
' Mod may error on key generation
/pP Ph,K2|-a lLngResult = (lLngMod * lLngResult) Mod Modulus Aw-I"]9`7`:a2V?
If Err Then Exit Function
` P ^"B.x ?9?wY Next
5Is7C6G0^m V Else
![2R,s%\h"Y lLngResult = pLngMessage
*EW!vKa,K-z Y;L For lLngIndex = 1 To pLngKey / 2 M,?;qGq4nr+F e
lLngMod = (pLngMessage ^ 2) Mod Modulus
|AE6Bg W A On Error Resume Next
1Z7n8gbD/}#?nK ' Mod may error on key generation !kh+V ] s,a
lLngResult = (lLngMod * lLngResult) Mod Modulus |Q%F5?9]W!O
If Err Then Exit Function a t&W-S-?i*X T f
Next 'fl#Tp OT
End If tk"~NM7b
Crypt = lLngResult
AL;N+H7n"F End Function&?N1W-yF6w
%|RFS*Gy d1bA
Public Function Encode(ByVal pStrMessage) G,q#QJ,v(L%x
Dim lLngIndex
_G zO\ Dim lLngMaxIndex
1a CQ:D[ Dim lBytAscii
:P eC'avZ2G!Gz y Dim lLngEncrypted
5SyUco RM;I lLngMaxIndex = Len(pStrMessage)
ujoHa-R0ZIK If lLngMaxIndex = 0 Then Exit Function
%f.b3O%R*H;ns For lLngIndex = 1 To lLngMaxIndex B%IiWE t\i
lBytAscii = Asc(Mid(pStrMessage, lLngIndex, 1))
1_^,^HIY-\5s lLngEncrypted = Crypt(lBytAscii, PublicKey)
:Rn:W|2K*m#? Encode = Encode & NumberToHex(lLngEncrypted, 4) v_v5j!TJ&A?m
Next
E#M;pm0_ End Function B`@9L4D$`!t4Jbc2|
Public Function Decode(ByVal pStrMessage) b!` g#K q
Dim lBytAscii
1I8t+V@8bb Dim lLngIndex
)]oZ-~9o,J$u$kZ4w Dim lLngMaxIndex \&J2i IV"gyV-MV
Dim lLngEncryptedData '^O'`Sj5FNym.F.p:OE
Decode = "" N6D r r-v6`p8z(j
lLngMaxIndex = Len(pStrMessage) S@rI0l
For lLngIndex = 1 To lLngMaxIndex Step 4
*t/n]B8{8Sz lLngEncryptedData = HexToNumber(Mid(pStrMessage, lLngIndex, 4)) X0}:_U)K0h
lBytAscii = Crypt(lLngEncryptedData, PrivateKey)
0uI D*u,M&_;b!e0V Vdn Decode = Decode & Chr(lBytAscii) wN(w_ _U[3eL;R
Next aB![Uk:KVWw{
End Function
X;xy;hL(X8i$p1f:c5N Private Function NumberToHex(ByRef pLngNumber, ByRef pLngLength)
v a.US`4] NumberToHex = Right(String(pLngLength, "0") & Hex(pLngNumber), pLngLength)
,r4b%x _(nX End Function 8V6Pn qOt'X'k,\
Private Function HexToNumber(ByRef pStrHex) 0fp!M gp7^2GO3bb
HexToNumber = CLng("&h" & pStrHex) 3v$^7}~[Fq
End Function pj9t`1?:}"DleN
End Class 5Jfl#j4\K tb Y
function Encryptstr(Message)
EVrP:D@#N B%i+| Dim LngKeyE +x+t@ K(Zhi
Dim LngKeyD $K M,y/Rs2ou
Dim LngKeyN
V5HiM.yuS Dim StrMessage )Mp(k)z-t {v
Dim ObjRSA
;ht,S4N.O]O LngKeyE = "32823" !w_(E J,D_5i'_
LngKeyD = "20643"
)f7gN1y1g vFH LngKeyN = "29893"
Z J7{ rQ$y? StrMessage = Message 6V$Z z"z^&M3kwKS"@ m
Set ObjRSA = New clsRSA
'egI.zJau ObjRSA.PublicKey = LngKeyE v5G#{"h&cC!Q1?,P
ObjRSA.Modulus = LngKeyN
3`"rJ,@z,M Encryptstr = ObjRSA.Encode(StrMessage) |b N0@*U
Set ObjRSA = Nothing
b*~_sSv%[&|IC end functionT i.w s+XWD4TcST
Function Decryptstr(Message) +NI2e4| |0GP QX
Dim LngKeyE q#U4a0{o.Y-}
Dim LngKeyD eb,|sM\9Z
Dim LngKeyN l D0\%T i3ecc
Dim StrMessage
5LlA2Isw,`W|.~ Dim ObjRSA !y~J g H7[
LngKeyE = "32823"
,ba.N-] gf@1_ LngKeyD = "20643" G`tj#P3U
LngKeyN = "29893" /l1x W.OqQ f
StrMessage = Message ,w"LVFkT"|3hr
Set ObjRSA = New clsRSA
$A*i#WC%b t-z ObjRSA.PrivateKey =LngKeyD
,_7`3o!}d#l*q!N5G3g ObjRSA.Modulus=LngKeyN +qWA{RD1a4K
decryptstr=ObjRSA.Decode(StrMessage) (rKzDt)nbt
Set ObjRSA = Nothing V dVP[7S
end function 5j]2CI(^Md|t
%>
's u6Dw_,v ===============================================
F2i/b Ur4] 8mHt"px h
还有一个用于测试这段代码的test.aspQB)|S `9Q W;O I
有兴趣的自己搭建个IIS测试下
Rl.M%YN(E <!--#INCLUDE FILE="RSA.asp"-->
#]5ESQ;`:V <%
Cp6[OU)Z%x'hw&Wu function Encryptstr(Message) )[M_]P Q
Dim LngKeyE
$\J.?a(we%? Dim LngKeyD
.]*m0o+Hu;rm Dim LngKeyN
uh N'O} \4Ta3r1p Dim StrMessage
,pO'`[xlZ} Dim ObjRSA
W^.u6b5c;r#@R LngKeyE = "32823"
3yH-Q Ni@%D(v LngKeyD = "20643" `/K2ME*f u.SJ
LngKeyN = "29893"
{q+pz(b2q StrMessage = Message
x%k@xJ-s5Q/n&h] Set ObjRSA = New clsRSA |$x4gi_qq+h!S*w
ObjRSA.PublicKey = LngKeyE
&|1o VC2{^0q2g9s(\G ObjRSA.Modulus = LngKeyN
n8gh u6T0vbc Encryptstr = ObjRSA.Encode(StrMessage)
i`x6G8b)fH]b Set ObjRSA = Nothing RU$LS7F0U|w
end function
R}sl9XI/x+{.L:c function decryptstr(Message) x2_9d'JE r
Dim LngKeyE
5^Z&y%Rs3j Dim LngKeyD ry7J*b^kR
Dim LngKeyN
,h%v*v[6Q1J Dim StrMessage ;ebG/sEE/DE
Dim ObjRSA J/b1LR-tW
LngKeyE = "32823"
'X}.A\|g5k LngKeyD = "20643"
do ?x1LB LngKeyN = "29893" 8s8pLu rWR
StrMessage = Message ,w!zzx.nn%{
Set ObjRSA = New clsRSA L M@lW
ObjRSA.PrivateKey =LngKeyD
T ]X)~:n'I"}Zp ObjRSA.Modulus=LngKeyN
'M:@9o"J'RMd decryptstr=ObjRSA.Decode(StrMessage) 6Ju6l kxj(u
Set ObjRSA = Nothing
#v/Q?-A8@4x end function KVD!U[,I;g.C*E
dim last,first
P%NG2_J FJ first="!@#$%^&*()" !aU PgY_;O7j
Response.Write "加密前为:"&first
x3KFxto last=Encryptstr(first)
WBe5Md$C6Nf Response.Write "加密后为"&last Py jZ y?/UB1N
Response.Write "解密后为" &decryptstr(last)
*G d e q(ivd#em %> ==============================================zmKj5{3M$f [T
剩下的就是字符的对照表了
&z#{9q-jV7?.b] ===================字符集================{!r9D,B%? YA(a'@
1_____6EBB%a7K$s[8x/o
2_____5C1F
&JcBO2r)_&nKM[ 3_____4D75'Fr"A'i$I[L,Jo:Wj
4_____26CCXh,c*sh4v2V;^ ^
5_____4F88;} A] S_/]z
6_____3F4E?y%U azf;wG2F&w
7_____0A9De6SC-J;v&D
8_____1A1C
fJft0l%HOE$Bkwm 9_____6D20
eL*NC,H7u s:bs$w 0_____1089
2Jb `1~G;R7Y*U a_____0F3E
7Vd~/B8T-h1db b_____3159
vzHkTu.\ c_____3517 j"g&c9jx$`0y
d_____419C
mF)H7wV!b e_____615C
@9f-R-H2wq f_____556F
~$G?,l2BjM"j$b6w g_____2B7F
4m sAC!kBT h_____0F9CO4Y7v-M@A
i_____00FA
l8k7\-K(pm2b(j j_____5A50
h+M7gz3B[i5Tq k_____2850 D6Y/W NR
l_____3E7B*D.b^+v#d,f.M A Y
m_____71C5q&p3C2fB~+g
n_____1FC80Q#E{0GE@|s
o_____74C1Xn)x.DT]*v,gr'O
p_____5FB8w;b(~V cM2^
q_____6085E3|eqU
r_____3AC4#j3q4}5{HHw'M!g ^[
s_____2F50
"AP;H*E\ t_____36F8jX K;pK!?7n
u_____7010(~7~t0`6^ s4M@
v_____0B42
/bB/n pm%f7E8N w_____1C7A_b\@0cT}d
x_____16F8
%w8_H\8_'N y_____2EE7
]w KpU YG*r^ z_____5CF3
D6BG$c;{hZf}v !_____6233
&V4k9f~#cZ @_____3A45)w3u#Y(T0k
#_____2291 m~^M/Pkf
$_____5D5C
,L*d @ n d4a %_____09B9
*e(T9v] N~ ^_____43EAR j!Y2G"t6L0T$[gE t0N9U
&_____62B9*g!szR8Dqov
*_____6301 k/Q%kk A m
(_____4659
,G[C1o:D*p3B )_____5C82

鱼儿无心 发表于 2011-12-4 17:17

收藏了。。。。。。。。

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.