\ASP\rc4
rc4test.asp
<%
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
'::: This script is an example of how to use the RC4 :::
'::: algorithm (included in rc4.inc). It can serve as :::
'::: a test harness for algorithm validation, as well. :::
'::: :::
'::: Note: This test expects to be called from a FORM :::
'::: POST, and should include the fields PSW (the :::
'::: password) and TXT (the plaintext) :::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
dim etime, stime
dim psw, txt
dim strTemp
dim x
etime = 0
stime = 0
psw = request.form("psw")
txt = request.form("txt")
response.write "RC4 Test Harness
Plaintext was: " & txt & "
"
stime = timer
strTemp = EnDeCrypt(txt, psw)
etime = cdbl(timer - stime)
' Here we display the encrypted text in urlencoded form.
' The reason it's urlencoded is because it is essentially now
' "binary" data, which may mess up many browser displays...
response.write "Encrypted text: " & server.urlencode(strTemp) & "
"
response.write "Hex dump of encrypted string:
"
for x = 1 to len(strTemp)
response.write right(string(2,"0") & hex(asc(mid(strTemp, x, 1))),2) & " "
if x mod 26 = 0 then response.write vbCRLF
next
txt = EnDeCrypt(strTemp, psw)
response.write "
Decrypted text:
" & txt & "
"
for x = 1 to len(txt)
response.write right(string(2,"0") & hex(asc(mid(txt, x, 1))),2) & " "
if x mod 26 = 0 then response.write vbCRLF
next
response.write "
Encryption took: " & etime & " seconds (±55 msec)"
response.write ""
response.end
%>