OK. I figured out how to compress strings! No one here knew howto, so I think it might be useful to look at this.
Heres an ip address...
127.234.111.133 (32 byte string)
êo… (8 bytes)
Both are the same IP address. Both are in string format.
the later is converted with this code, which can easily be converted back a minute later.
This isnt encryption by any means.
Its the exact way your computer stores information.
VB Code:
Public Function MakeDWORD(Data As Long) As String Dim tmp As String, a As String, b As String, c As String, d As String tmp = Right("00000000" & Hex(Data), 8) a = Mid(tmp, 1, 2) b = Mid(tmp, 3, 2) c = Mid(tmp, 5, 2) d = Mid(tmp, 7, 2) MakeDWORD = Chr(Val("&H" & d)) MakeDWORD = MakeDWORD & Chr(Val("&H" & c)) MakeDWORD = MakeDWORD & Chr(Val("&H" & b)) MakeDWORD = MakeDWORD & Chr(Val("&H" & a)) End Function Public Function MakeWORD(Data As Integer) As String Dim tmp As String, a As String, b As String tmp = Right("0000" & Hex(Data), 4) a = Mid(tmp, 1, 2) b = Mid(tmp, 3, 2) MakeWORD = Chr(Val("&H" & b)) MakeWORD = MakeWORD & Chr(Val("&H" & a)) End Function Public Function MakeBYTE(Data As Byte) As String Dim tmp As String MakeBYTE = Chr(Val("&H" & Right("00" & Hex(Data), 2))) End Function Public Function ToNumeric(ByVal hSource As Variant) As String Select Case Len(hSource) Case 1 ToNumeric = Right("00" & Hex(Asc(hSource)), 2) Case 2 one = Mid(hSource, 1, 1) two = Mid(hSource, 2, 1) ToNumeric = Right("00" & Hex(Asc(two)), 2) ToNumeric = ToNumeric & Right("00" & Hex(Asc(one)), 2) Case 4 one = Mid(hSource, 1, 1) two = Mid(hSource, 2, 1) three = Mid(hSource, 3, 1) four = Mid(hSource, 4, 1) ToNumeric = Right("00" & Hex(Asc(four)), 2) ToNumeric = ToNumeric & Right("00" & Hex(Asc(three)), 2) ToNumeric = ToNumeric & Right("00" & Hex(Asc(two)), 2) ToNumeric = ToNumeric & Right("00" & Hex(Asc(one)), 2) End Select ToNumeric = Val("&H" & ToNumeric) End Function




Reply With Quote