Похоже, в ASP не так много методов шифрования. Теперь, основываясь на информации старшего, функции шифрования и дешифрования разбираются в ASP.
RSA.asp
<%
REM реализует шифрование и дешифрование в ASP, метод шифрования: согласно RSA
REM Contact: [email protected]
Classclsrsa
PublicprivateKey
Publicpublickey
Publicmodulus
PublicfunctionCrypt (plngmessage, plngkey)
OnerRorResumenext
Dimllngmod
Dimllngresult
Dimllngindex
Ifplngkeymod2 = 0then
llngresult = 1
Forllngindex = 1toplngkey/2
llngmod = (plngmessage^2) modmodulus
'ModmayerroronKeyGeneration
llngresult = (llngmod*llngresult) modmodulus
IferrthenexitFunction
Следующий
Еще
llngresult = plngmessage
Forllngindex = 1toplngkey/2
llngmod = (plngmessage^2) modmodulus
OnerRorResumenext
'ModmayerroronKeyGeneration
llngresult = (llngmod*llngresult) modmodulus
IferrthenexitFunction
Следующий
Эндиф
Crypt = llngresult
Конечная функция
Publicfunctionencode (byvalpstrmessage)
Dimllngindex
DimllngmaxIndex
Dimlbytascii
Dimllngencrypted
llngmaxIndex = len (pstrmessage)
IfllngmaxIndex = 0TheneXitFunction
Forllngindex = 1tollngmaxIndex
lbytascii = asc (mid (pstrmessage, llngindex, 1)))
llngencrypted = crypt (lbytascii, publickey)
Encode = Encode & NumberTohex (llngencrypted, 4)
Следующий
Конечная функция
PublicfunctionDecode (byvalpstrmessage)
Dimlbytascii
Dimllngindex
DimllngmaxIndex
Dimllngencrypteddata
Декод = ""
llngmaxIndex = len (pstrmessage)
Forllngindex = 1tollngmaxIndexstep4