4 Attachment(s)
VB6 - bEncode() and bDecode()
Simple encode/decode functions, whats so special about them you ask?
Well, you can recompile the byte map arrays on the fly so your bEncode() can't be bDecoded()'d by others so easily.
In a module:
VB Code:
Option Explicit
Private bEncodeMap(0 To 255) As Byte
Private bDecodeMap(0 To 255) As Byte
Public Sub bInit()
' byte arrays go here
End Sub
Public Function bEncode(ByRef s As String) As String
Dim i As Integer
bEncode = ""
For i = 1 To Len(s)
bEncode = bEncode & Chr(bEncodeMap(Asc(Mid$(s, i, 1))))
Next i
End Function
Public Function bDecode(ByRef s As String) As String
Dim i As Integer
bDecode = ""
For i = 1 To Len(s)
bDecode = bDecode & Chr(bDecodeMap(Asc(Mid$(s, i, 1))))
Next i
End Function
In a form:
VB Code:
Option Explicit
Private Sub Form_Load()
Dim s As String
bInit
s = "some text to encode"
s = bEncode(s)
Debug.Print "Encoded", s
s = bDecode(s)
Debug.Print "Decoded", s
End Sub
Re: VB6 - bEncode() and bDecode()
Please put together zip file versions of your attachments as many of our members (myself included) can not open .rar files.
Thanks.
Re: VB6 - bEncode() and bDecode()
Hello!
I need to open a .torrent using bdecode, someone can help me?
Thanks