Classic ASP
Classic ASP
Obfuscate String
Demonstrates how to obfuscate and unobfuscate a string.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set sb = Server.CreateObject("Chilkat.StringBuilder")
s = "Hello World!"
success = sb.Append(s)
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"
' Output is "Hello World!";
' Obfuscate the string.
' This is NOT encryption. It's just a simple obfuscation.
sb.Obfuscate
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"
' Output is 2GsgGhbSQVyG8Vb9
' -------------------------
' Unobfuscate.
set sb2 = Server.CreateObject("Chilkat.StringBuilder")
s2 = "2GsgGhbSQVyG8Vb9"
success = sb2.Append(s2)
sb2.Unobfuscate
Response.Write "<pre>" & Server.HTMLEncode( sb2.GetAsString()) & "</pre>"
' Output is "Hello World!";
%>
</body>
</html>