[.NET] BASE64 ENCODE OR DECODE

Hi mọi người, sau một hồi loay hoay tìm hiểu thủ thuật nhắn tin cho người yêu mà theo phương thức mã hóa tốt nhất để khi nhắn tin người đó sẽ chủ động dịch người lại đoạn mã hóa mà mình gủi cho ngưởi đó để nhắn tin với nhau mà không sợ bị người khác thấy bội dung :D. Và mình dã tìm ra thủ thuật này, nhưng nó bị giới hạn là đoạn nội dung đó không quá dài, và chỉ ngắn gọn súc tích thôi nhé mọi người :D.
Bên dưới là hình ảnh mình viết ra để phục vụ cho mục đích trên.
[.NET] BASE64 ENCODE OR DECODE

Mình chưa tích hợp chat messenger của facebook vào để cho tiện cho người dùng nhé mọi người, vì đây là sau quá trình tìm hiểu về thủ thuật và cách để phân tích mã hóa code đó. :D

FULL CODE :

Imports System.Net
Imports System.IO
Imports System.Net.Mail
Imports System.Threading
Imports System.Security.Cryptography
Imports System.Text
Public Class Form1
#Region "PANEL MOVING"
    Dim drag As Boolean
    Dim mousex As Integer
    Dim mousey As Integer
    Private Sub Panel2_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
        drag = True
        mousex = Windows.Forms.Cursor.Position.X - Me.Left
        mousey = Windows.Forms.Cursor.Position.Y - Me.Top
    End Sub
    Private Sub Panel2_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mousey
            Me.Left = Windows.Forms.Cursor.Position.X - mousex
        End If
    End Sub
    Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel1.MouseDown
        drag = True
        mousex = Windows.Forms.Cursor.Position.X - Me.Left
        mousey = Windows.Forms.Cursor.Position.Y - Me.Top
    End Sub
    Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel1.MouseMove
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mousey
            Me.Left = Windows.Forms.Cursor.Position.X - mousex
        End If
    End Sub
    Private Sub Panel2_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
        drag = False
    End Sub
    Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel1.MouseUp
        drag = False
    End Sub
    Dim textbytes, encryptedtextbytes As Byte()
    Dim rsa As New RSACryptoServiceProvider
    Dim encoder As New UTF8Encoding
    Dim encrypted, TextToDecrypt, TextToEncrypt, decrypted As String
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            TextToEncrypt = TextBox1.Text
            encrypt()
            TextBox2.Text = encrypted
            ' TextBox2.Enabled = True
            Button3.Enabled = True
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Try
            TextToDecrypt = TextBox1.Text
            decrypt()
            TextBox2.Text = decrypted
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
#End Region
    Sub encrypt()
        'Use UTF8 to convert the text string into a byte array
        textbytes = encoder.GetBytes(TextToEncrypt)
        'encrypt the text
        encryptedtextbytes = rsa.Encrypt(textbytes, True)
        'Convert the encrypted byte array into a Base64 string for display purposes
        encrypted = Convert.ToBase64String(encryptedtextbytes)
    End Sub
    Sub decrypt()
        encryptedtextbytes = Convert.FromBase64String(TextToDecrypt)
        'get the decrypted clear text byte array
        textbytes = rsa.Decrypt(encryptedtextbytes, True)
        'convert the byte array to text using the same encoding format that was used for encryption
        decrypted = encoder.GetString(textbytes)
    End Sub

    Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
        End
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        My.Computer.Clipboard.SetText(TextBox2.Text)
        Label4.Text = "Copy Successfull"
    End Sub
End Class

Trong đoạn code trên mình có tích hợp thêm mã code FLAT UI để làm đẹp cho giao diện nhé mọi người, nếu ai không thích thì có thể loại bỏ code đó ra để tối ưu thủ thuật này thật tốt nhé.

DOWNLOAD PROJECT  


DOWNLOAD FULL CODE + DEMO

MẬT KHẨU GIẢI NÉN: hungqb.com
Chúc mọi người thành công với thủ thuật đơn giản này.

PASSWORD UNZIP: HUNG.PRO.VN
Chúc Mọi Người Thành Công Với Thủ Thuật Trên.
Nếu mọi người có vướng mắc gì mình chia sẽ trên trang có thể gửi liên hê cho mình tại đây nhé.
Cảm ơn mọi người đã quan tâm.

7 comments:

Ngọc Ánh said...

nice app

Hung Program VN said...

Blog chuyển nhượng quản lý rồi nhé mọi người :D

Learning Code said...

chuyển cho ai vậy e???

Khoa Nguyen said...

Hùng nó bán blog r` đó ô, và chuyển nhượng lại blog cho 1 lão code trong nhóm của nó, mà chủ yếu nó kiếm lượt search google để làm gì k biết, chứ dạo này thấy nó cày backlink hơi bị gắt haha, làm ngó tiến bộ lắm, nhưng search từ khóa thì chưa ổn lắm, vì domain này có chút dính dáng nên nó giữ lại đấy, không nó chuyển tên miền khác luôn r` !

Anonymous said...

There are many encrypted websites, so there's no need to bother with a program like this.

Hung Program VN said...

yes. i learning code <3

Khoa Nguyen said...

hi fr, i'm learn code, and how to project settings ...v.v bla bla hehe tks support

All Right Reserved © 2015 By Hung Pro VN