Advertisement
2002ASP Encryption #251

EnHex / DeHex

EnHex converts a string to hexidecimal characters, which I designed for use with encryption routines that sometimes output unprintable characters. It's a simple way to convert unprintable characters into something printable. DeHex simply reverses the process.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Public Function EnHex(Data As String) As String
  Dim iCount As Double
  Dim sTemp As String
  
  For iCount = 1 To Len(Data)
    sTemp = Hex$(Asc(Mid$(Data, iCount, 1)))
    If Len(sTemp) < 2 Then sTemp = "0" & sTemp
    EnHex = EnHex & sTemp
  Next iCount
End Function
Public Function DeHex(Data As String) As String
  Dim iCount As Double
  For iCount = 1 To Len(Data) Step 2
    DeHex = DeHex & Chr$(Val("&H" & Mid$(Data, iCount, 2)))
  Next iCount
End Function
Original Comments (3)
Recovered from Wayback Machine