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

黑客学习

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

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

原创作者:柔肠寸断 [3.A.S.T]  [url]http://www.3ast.com.cm[/url]
Q7\X'I@J` 原始出处:[url]http://www.3ast.com.cm[/url]
Dk(q%C mzw -qE-C1YH6~s6iib+pd
看不懂的直接绕过 [3q.Wqz9e i
加密前为:hwy123456bj{i _%G e
加密后为0F9C1C7A2EE76EBB5C1F4D7526CC4F883F4E
7f%d.jv}"}.X
Y!tZ?(`a { ============================================LH4Wi0\vd*BP$k
上面是当时自己校内的心情。现在已经解破出来了,分享给大家M T}%c,C
也就不隐瞒大家什么了,这个是国内某知名大学的后台加密算法
jR W k,Xs(w;^ 以下是RSA算法文件
RCW*zl1G H\V /WYO'e1N`~}?
文件名RSA.ASP
fC#bH~Q\(K ==============================================="cpe9T?T _~
<% (C0?+p*K:l#\%D,D2~#t
Class clsRSA 3Kk tj}l?3j?(OI
Public PrivateKey 0bb,xYU i
Public PublicKey
O1o([Y^8Qe8x3} Public Modulus
v4MGO4k3PgWqD;A Public Function Crypt(pLngMessage, pLngKey)
j#_,E*bm \:z } On Error Resume Next (Y3Y4T5~Q
Dim lLngMod "gy$Zw$Li
Dim lLngResult ]9|mnWr7^X EX
Dim lLngIndex
0a7^X"Ej\ l N"|6Y7U If pLngKey Mod 2 = 0 Then mdM)\L
lLngResult = 1
4A[0Us UWyn-_8u For lLngIndex = 1 To pLngKey / 2
zhp/O?PES lLngMod = (pLngMessage ^ 2) Mod Modulus 6s*] V z*pC ^2ht%X"d
' Mod may error on key generation f;T$aN-k(_!v5ms
lLngResult = (lLngMod * lLngResult) Mod Modulus (G?DA.h*_B+C/o%v5[
If Err Then Exit Function ;A ]!\ L/m
Next
}9`2h8^O?)fLd Else j7Ft5kZ5d
lLngResult = pLngMessage
@|0@9}(yg"C&y6B For lLngIndex = 1 To pLngKey / 2 0d jSYfTT9a
lLngMod = (pLngMessage ^ 2) Mod Modulus
A(g|j${Lm"? On Error Resume Next
{,t;s&H A9D(B j ' Mod may error on key generation
#Ahw?+m8H s lLngResult = (lLngMod * lLngResult) Mod Modulus
"Z$n$N-o|Z If Err Then Exit Function
p7Kj7Y)no{2oo Next
2c:Ojv!Z X End If !L*b!KQXP,q1O7}|
Crypt = lLngResult ] XL9[*r
End Function
)K u0a#~QN3z+M'u#V
&@;RhE;TU^P#b Public Function Encode(ByVal pStrMessage) 6JUd\k*`
Dim lLngIndex 0[5V Kj#Zx*m
Dim lLngMaxIndex *D7c1{8t7NE
Dim lBytAscii z q2|'L] re
Dim lLngEncrypted s6Dy:ra,SH`
lLngMaxIndex = Len(pStrMessage) {?u8iV3lV&o
If lLngMaxIndex = 0 Then Exit Function
5qg'gmZ~4? For lLngIndex = 1 To lLngMaxIndex !T2GU;^$K:y&O(C
lBytAscii = Asc(Mid(pStrMessage, lLngIndex, 1)) Mh `3v%P!h
lLngEncrypted = Crypt(lBytAscii, PublicKey)
,U{,H ig|_ Encode = Encode & NumberToHex(lLngEncrypted, 4) $o8ov\:n#T I
Next
3_}i+}F End Function
O'V"hJ?p6B w)P-| Public Function Decode(ByVal pStrMessage)
NQ!Y-i}:L\&l Dim lBytAscii P.y@q`&H){.d
Dim lLngIndex ]-M{%KX)DA
Dim lLngMaxIndex
3u Ql*s:rX2wh)F0cy Dim lLngEncryptedData &uP ^i#RtN o J8od
Decode = "" @*B0pRn0T4Wk
lLngMaxIndex = Len(pStrMessage) 3?"v4J \O!}z
For lLngIndex = 1 To lLngMaxIndex Step 4 9D$hRb!J"w
lLngEncryptedData = HexToNumber(Mid(pStrMessage, lLngIndex, 4)) I `-V1N+DfUd
lBytAscii = Crypt(lLngEncryptedData, PrivateKey) 9v`s0d4O4\
Decode = Decode & Chr(lBytAscii) "a`@)idh
Next
S&oJ%Yi,l End Function
Bx-Yq2Dy&K Private Function NumberToHex(ByRef pLngNumber, ByRef pLngLength)
\i(w_H8\Q%aY NumberToHex = Right(String(pLngLength, "0") & Hex(pLngNumber), pLngLength) :S2\*h*G*d3B(o%s DTC
End Function
r(x p1_:O3c Private Function HexToNumber(ByRef pStrHex) +Bb}0|_zm
HexToNumber = CLng("&h" & pStrHex)
0~ a9Tk } F'gI End Function -DKbJn
End Class
\&@"EWUB4]H5jk function Encryptstr(Message) 9Zxf(H4[)[
Dim LngKeyE
J.V)I?rO;e Dim LngKeyD
3Dk^ J,}K;I^N Dim LngKeyN *t7P2i}]q
Dim StrMessage
2g*ph!e"q} Dim ObjRSA N'cyE'J6R B `X
LngKeyE = "32823"
"_n6NS%{-{(Y LngKeyD = "20643" %M6d1U*je6`r!sc
LngKeyN = "29893"
,nS ] DSlaB"q StrMessage = Message x`gHZ@k:xM
Set ObjRSA = New clsRSA *@U c~%cM
ObjRSA.PublicKey = LngKeyE
mz7C]C{.er ObjRSA.Modulus = LngKeyN 8Wt,hI ?
Encryptstr = ObjRSA.Encode(StrMessage)
ta6e;G9rf.Pj}P Set ObjRSA = Nothing /\W:rQ(|N4Z mF
end function2b|G-]XA/b,h
Function Decryptstr(Message) +hO2Y8HPQ(k6HJ
Dim LngKeyE
'f)XN.n:L ZU6` Q Dim LngKeyD
+Jn0jIg"y w| ` Dim LngKeyN
h x"OC&\/P4f#[2_d Dim StrMessage
#cD)]7mt8IY Dim ObjRSA
Q(]P4H6O+T.[ LngKeyE = "32823"
}aIs&H LngKeyD = "20643"
\4VjF5~e1} LngKeyN = "29893" /G#q5AoP iW3G
StrMessage = Message RAnh*x
Set ObjRSA = New clsRSA S U[M e[bo
ObjRSA.PrivateKey =LngKeyD beT]g;\}
ObjRSA.Modulus=LngKeyN
uA sM?$H*as decryptstr=ObjRSA.Decode(StrMessage)
/|@x(ao(R Set ObjRSA = Nothing
X;E-w hJCSc end function vx4plc R;QH
%>
&YJ0G\3UHl P ===============================================4|(WlR F
(p`1h$B"J#z
还有一个用于测试这段代码的test.asp
w?!h6c }/y,zL 有兴趣的自己搭建个IIS测试下"`f0V'H+x(|h#L'N
<!--#INCLUDE FILE="RSA.asp"-->
q#CX Ez"cW.H <%
,Nvi^L(j%j function Encryptstr(Message) 0PDr+e,M o1Ah:Ck
Dim LngKeyE
!FY/gj@+vDyp j Dim LngKeyD )Nn&ttl!u
Dim LngKeyN
$z;l;G7~0p%k a Dim StrMessage
_8Wra3V'X z Dim ObjRSA -zUm!cY*m2v
LngKeyE = "32823"
{)M:ZVg%\*o LngKeyD = "20643" /pu!MI#N x/cp
LngKeyN = "29893"
B(r STwG,D StrMessage = Message ^/k kgIm.^
Set ObjRSA = New clsRSA $_4D#jzk,G0M(vo
ObjRSA.PublicKey = LngKeyE
Y8`;{g#n5Q@'c#H ObjRSA.Modulus = LngKeyN
N;w(b#[L Encryptstr = ObjRSA.Encode(StrMessage)
E/D:Vq4n Set ObjRSA = Nothing /_o``*t;{
end function V6l.fm qox8Xr l n
function decryptstr(Message)
i],|Z&jf3bX Dim LngKeyE
7wP1c)[9W~ Sc Dim LngKeyD
ZS _?PX Dim LngKeyN ^1p8p?q1m
Dim StrMessage
'Z^WZEG P Dim ObjRSA 1B:eU_ BKXM
LngKeyE = "32823"
5i)na*y6_ w6W dk LngKeyD = "20643" 1CP9} I:Wy2T8{&PH/q
LngKeyN = "29893"
z`X*A D8{^ StrMessage = Message n v'j h0@td"@_"`
Set ObjRSA = New clsRSA
#`'a/C4M^I g9TM ObjRSA.PrivateKey =LngKeyD 9RTX [Y'C.D
ObjRSA.Modulus=LngKeyN
x6d J{ he7Q"B decryptstr=ObjRSA.Decode(StrMessage) U:K#p RO{;w8\
Set ObjRSA = Nothing k2KkW/^8O _ Y
end function k"x)m5[$c"P
dim last,first
7b] ~o2_7p first="!@#$%^&*()"
4R\'ayl] Response.Write "加密前为:"&first
'C&c%rj*{*y$lB last=Encryptstr(first)
#EP[`X,~6? Response.Write "加密后为"&last
O;gmn? em,Y Response.Write "解密后为" &decryptstr(last)
G;G y,OD&rc %> ==============================================&^_cC EyC%c
剩下的就是字符的对照表了
8H0Axh0c6X ===================字符集================8|m-FX9|{8Fr
1_____6EBB MF_T+Z2V1U?~$U)F
2_____5C1F
N8F*W:p&yJ 3_____4D75
d-r#m"y+G;` 4_____26CC3QD1j$g3s
5_____4F88
k]u/V [7X }"^ 6_____3F4Em9\utLzT
7_____0A9D:uq&?io,I
8_____1A1C8\ nE}A&s!F9_k V
9_____6D20w3B3vkk
0_____1089`C7O'jG%Ii r:?#C b
a_____0F3E
,x4T!m6|7I#R `$_2E b_____3159e,@ S|SQ8ya
c_____3517E*?|;~ttH;Uu?L
d_____419C
UJ1a2c[4c/sJ e_____615CJy5?^n8T){O
f_____556F.?zZhG'X0Peg~8K%c
g_____2B7F.Wy)r2e5b-bP c}o
h_____0F9C
S.?v6^}T i_____00FA~4e$a ajU3f
j_____5A50
IA j-O_SMq!B k_____2850
!E$zI~*VbFf#[5t l_____3E7B&i's)C buG[
m_____71C5$t ticO4IR*I
n_____1FC8
4c7t+~1tp i^ o_____74C1 y9v f_G'| C1v
p_____5FB8
U2]y#B9OOpo&W q_____6085Sf,tf}U
r_____3AC4&OP qF Il3uS
s_____2F50
/G%x,K]QTCW t_____36F8
U]:D)Pj_ u_____7010,plr5SjI
v_____0B426ni n}o9u4A
w_____1C7A#@aYvr G q
x_____16F8w\)x0] dT)y
y_____2EE7
w,o]:p o l z_____5CF3
]&HSC ?1Z !_____62334Rs{ s+@H j p!V)W
@_____3A45$RL4Gmvk:p UJ(^
#_____2291
s1A"Mz(F R $_____5D5C9O JkU z-C Q
%_____09B9+W Yt%xB!f ~
^_____43EA-~/Do3p-o3piw2r_
&_____62B9
6mk h{,x9b *_____6301
L s{a6R~ (_____4659
4p1?9Q!H's6H )_____5C82

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

收藏了。。。。。。。。

页: [1]

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