<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<input id=Text1 style="width:400" ><br>
<input type=button value=convert onclick="convert()">
<div id="Text2"></div>
</BODY>
<SCRIPT LANGUAGE=vbscript>
Sub convert()
s = UCase(Replace(Text1.value, " ", ""))
d = ""
dstr = ""
chstr = ""
For i = 1 To Len(s) Step 2
h = Left(s, 2)
s = Mid(s, 3)
h = decodePackage(a2h(h))
hx = Hex(h)
if h < 16 then
d = d & " " & "0" & hx
else
d = d & " " & hx
end if
Next
Text2.InnerText = Text2.InnerText & vbNewLine + d
End Sub
Function decodePackage(value)
Dim mask
mask = &HAD
decodePackage = value Xor mask
End Function
Public Function a2h(alpha)
hextemplate = "0123456789ABCDEF"
If Len(alpha) = 2 Then
ahindex = InStr(1, hextemplate, Left(alpha, 1)) - 1
alindex = InStr(1, hextemplate, Right(alpha, 1)) - 1
a2h = (ahindex * (16 ^ 1)) + (alindex * (16 ^ 0))
ElseIf Len(alpha) = 4 Then
ahindex = InStr(1, hextemplate, Mid(alpha, 1, 1)) - 1
alindex = InStr(1, hextemplate, Mid(alpha, 2, 1)) - 1
al = (ahindex * (16 ^ 1)) + (alindex * (16 ^ 0))
ahindex = InStr(1, hextemplate, Mid(alpha, 3, 1)) - 1
alindex = InStr(1, hextemplate, Mid(alpha, 4, 1)) - 1
ah = (ahindex * (16 ^ 1)) + (alindex * (16 ^ 0))
a2h = (ah * (2 ^ 4)) + al
End If
End Function
</SCRIPT>
</HTML>