ดูเหมือนจะมีวิธีการเข้ารหัสไม่มากนักใน ASP ตอนนี้ขึ้นอยู่กับข้อมูลของผู้อาวุโสฟังก์ชั่นการเข้ารหัสและการถอดรหัสจะถูกจัดเรียงใน ASP
rsa.asp
-
REM ใช้การเข้ารหัสและถอดรหัสใน ASP วิธีการเข้ารหัส: ตาม RSA
REM ติดต่อ: [email protected]
classclsrsa
PublicPrivateKey
สาธารณะ
Publicmodulus
PublicFunctionCrypt (plngmessage, plngkey)
onerrorresumenext
dimllngmod
dimllngresult
dimllngindex
ifplngkeYmod2 = 0 แล้ว
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
ต่อไป
endif
crypt = llnGresult
endfunction
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 & NUMBERTOEHEX (llnGenCrypted, 4)
ต่อไป
endfunction
PublicFunctionDecode (byvalpstrmessage)
dimlbytascii
dimllngindex
dimllngmaxindex
dimllngencrypteddata
decode = ""
llngMaxIndex = len (pStrMessage)
forllngindex = 1tollngmaxindexstep4