function | decryption | string <%
Function Encrypt (Thenumber)
On Error Resume Next
Dim N, Szenc, T, HiN, LoN, I
n = CDBL ((thenumber + 1570) ^ 2-7 * (Thenumber + 1570)-450)
If N < 0 Then Szenc = "R" Else szenc = "J"
n = CStr (ABS (n))
For i = 1 to Len (n) Step 2
t = Mid (n, I, 2)
If Len (t) = 1 Then
Szenc = Szenc & T
Exit for
End If
HiN = (CInt (t) and 240)/16
LoN = CInt (t) and 15
Szenc = Szenc & CHR (ASC ("M") + HiN) & CHR (ASC ("C") + LoN)
Next
Encrypt = Szenc
End Function
Function Decrypt (Thenumber)
On Error Resume Next
Dim e, N, sign, T, HiN, LoN, newn, I
E = Thenumber
If left (e, 1) = "R" Then sign =-1 Else sign = 1
E = Mid (E, 2)
newn = ""
For i = 1 to Len (e) Step 2
t = Mid (E, I, 2)
If ASC (T) >= ASC ("0") and ASC (T) <= ASC ("9") Then
newn = newn & T
Exit for
End If
HiN = Mid (t, 1, 1)
LoN = Mid (T, 2, 1)
HiN = (ASC (HiN)-ASC ("M")) * 16
LoN = ASC (LoN)-ASC ("C")
t = CStr (HiN Or LoN)
If Len (t) = 1 Then t = "0" & T
newn = newn & T
Next
E = CDBL (newn) * Sign
Decrypt = CLng ((7 + SQR (49-4 * ( -450-E)))/2-1570)
End Function
%>
Original number:69 <br>
Encrypt (RETURNS:JNMQMOJ8) <br>
Decrypt ("JNMQMOJ8") returns:69
<p>
Another example using variables instead: <br>
Encrypt (Request.Form ("ID")) <br>
Encrypt (MyVar) <br>
Decrypt (Request.QueryString ("id")) <br>
Decrypt ("JNMQMOJ8") <br>
Decrypt (MyVar)
</body>