Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Credits : ibennz
- Public Class Form1
- Private mByte As Byte() = {}
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim tmp As String = "Hello"
- mByte = LBE_Encrypt(System.Text.Encoding.UTF8.GetBytes(tmp), New Byte() {0, 2, 4})
- MsgBox(mByte.Length)
- End Sub
- Private Function LBE_Encrypt(data As Byte(), pass As Byte()) As Byte()
- Dim out As New List(Of Byte)
- Dim c As Integer = 0
- For Each b As Byte In data
- If c >= pass.Length Then : c = 0 : End If
- If CInt(b) + CInt(pass(c)) < 255 Then
- out.Add(b + pass(c))
- Else
- out.Add(b - pass(c))
- End If
- Next
- Return out.ToArray
- End Function
- Private Function LBE_Decrypt(data As Byte(), pass As Byte()) As Byte()
- Dim out As New List(Of Byte)
- Dim c As Integer = 0
- For Each b As Byte In data
- If c >= pass.Length Then : c = 0 : End If
- If CInt(b) + CInt(pass(c)) < 255 Then
- out.Add(b - pass(c))
- Else
- out.Add(b + pass(c))
- End If
- Next
- Return out.ToArray
- End Function
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- MsgBox(System.Text.Encoding.UTF8.GetString(LBE_Decrypt(mByte, New Byte() {0, 2, 4})))
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment