Text to Hex/Hex to Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I want to convert text to hexadecimal text and vice versa. Is this possible?

(It is to be used to secure files - they dont need high level encryption.
The files are exported from one PC to disk and to be 'Read' into a different
PC for viewing the content)

Cheers,
Steve.
 
Klatuu said:
Using Hex representation will be pretty clumsy, because Hex only converts
numbers, which means every Alpha character must be converted to ASCII
representation. So, the letter "a" in ASCII is 61. Such a scheme would
have a hard time distinguishing whether the 61 should be converted back as a
number or a string.
Here is an encryption routine I use that workd really well. Pass iToDo 1 to
encode the string and 2 to decode it and strPass is the value to be
converted. You will not need to use the iSeed argument.

Public Function EncryptCode(iToDo As Integer, strPass As String, _
Optional iSeed As Integer) As String
Dim strValue As String
Dim lngMxx As Long
Dim lngPlace As Long

iSeed = IIf(iSeed = 0, 105, iSeed + 95)

For lngMxx = 1 To Len(strPass)
If iToDo = 1 Then
' encode
lngPlace = (Asc(Mid(strPass, lngMxx, 1)) + 2550 + iSeed - lngMxx)
Mod 255
Else
' decode
lngPlace = 255 - (Abs((Asc(Mid(strPass, lngMxx, 1)) - 2550 -
iSeed + lngMxx) Mod 255))
End If
strValue = strValue + Chr(lngPlace)
Next

EncryptCode = strValue

End Function

I would suggest you forget about finding a software solution. Why not get
the "customer" to sign a receipt/log etc when he recieves the data disc.
chin chin
 
Back
Top