May 23, 2011 11:08 AM
(This post was last modified: May 24, 2011 10:10 AM by RiperFish.)
Tutorial By ThePrinCe
Crypter/Decrypter : .Txt,Images,Songs,web Page,Exel,Word,Adobe reader ..Ect
1.Create a New Project
2.Create A TextBox (1), And Three (3) Buttons
2.1Name First Button (Browse )
2.2Name The Second Button ( Cypt )
2.3Name THe Third Button ( Decrypt )
3.Now We Go To The Codes :
3.1. Import This :
Code
Imports System.IO
Imports System.Security
Imports System.Security.Cryptography
Imports System.Text3.2. Add This Codes :
Code
Sub change()
Dim sr As StreamReader = New StreamReader(TextBox1.Text, System.Text.Encoding.Default)
Dim line As String
line = sr.ReadToEnd.TrimEnd()
sr.Close()
Dim sw As New StreamWriter("d:\tmp.tmp", False, System.Text.Encoding.UTF8)
sw.Write(line)
sw.Close()
My.Computer.FileSystem.DeleteFile(TextBox1.Text) '
My.Computer.FileSystem.CopyFile("d:\tmp.tmp", TextBox1.Text)
My.Computer.FileSystem.DeleteFile("d:\tmp.tmp")
End SubThis Code IS To change From ANSI TO UTF8
3.2.1.
Code
Sub change_ansi()
Dim sr As StreamReader = New StreamReader(TextBox1.Text, System.Text.Encoding.UTF8)
Dim line As String
line = sr.ReadToEnd.TrimEnd()
sr.Close()
Dim sw As New StreamWriter("d:\tmp.tmp", False, System.Text.Encoding.Default)
sw.Write(line)
sw.Close()
My.Computer.FileSystem.DeleteFile(TextBox1.Text) '
My.Computer.FileSystem.CopyFile("d:\tmp.tmp", TextBox1.Text)
My.Computer.FileSystem.DeleteFile("d:\tmp.tmp")
End SubThis Code Is To 'Change From UTF8 To ANSI
3.2.2.
Code
Sub krypt() 'krypte les fichiers en DES
change()
Dim MyFile As String = "d:\tmp.tmp"
Dim Key As New DESCryptoServiceProvider
Key.Key() = Encoding.UTF8.GetBytes("Password")
Key.IV() = Encoding.UTF8.GetBytes("Password")
Dim sr As StreamReader = New StreamReader(TextBox1.Text)
Dim line As String
line = sr.ReadToEnd.TrimEnd()
sr.Close()
EncryptMyFile(line, MyFile, Key.Key, Key.IV)
My.Computer.FileSystem.DeleteFile(TextBox1.Text) '
My.Computer.FileSystem.CopyFile(MyFile, TextBox1.Text)
My.Computer.FileSystem.DeleteFile(MyFile)
End Sub3.2.3.
Code
Sub dekrypt()
Dim MyFile = TextBox1.Text
Dim FileDecry As String = "d:\tmp.tmp"
Dim Key As New DESCryptoServiceProvider()
Key.Key() = Encoding.UTF8.GetBytes("motpasse")
Key.IV() = Encoding.UTF8.GetBytes("motpasse")
Dim Final As String = DecryptMyFile(MyFile, Key.Key, Key.IV)
Dim sw = New StreamWriter(FileDecry)
sw.WriteLine(Final)
sw.Flush()
sw.Close()
My.Computer.FileSystem.DeleteFile(MyFile) '
My.Computer.FileSystem.CopyFile(FileDecry, TextBox1.Text)
My.Computer.FileSystem.DeleteFile(FileDecry)
change_ansi()
End Sub[code]
3.2.4.
[code] Function EncryptMyFile(ByVal data As String, ByVal MyFile As String, ByVal Key() As Byte, ByVal IV() As Byte) As Byte
Dim fStream As FileStream = File.Open(MyFile, FileMode.OpenOrCreate)
Dim cStream As New CryptoStream(fStream, New DESCryptoServiceProvider().CreateEncryptor(Key, IV), CryptoStreamMode.Write)
Dim write As New StreamWriter(cStream)
write.WriteLine(data)
write.Close()
cStream.Close()
fStream.Close()
End Function
Function DecryptMyFile(ByVal MyFile As String, ByVal Key() As Byte, ByVal IV() As Byte) As String
On Error Resume Next
Dim fStream As FileStream = File.Open(MyFile, FileMode.OpenOrCreate)
Dim cStream As New CryptoStream(fStream, New DESCryptoServiceProvider().CreateDecryptor(Key, IV), CryptoStreamMode.Read)
Dim sReader As New StreamReader(cStream)
Dim Value As String = sReader.ReadToEnd.TrimEnd()
sReader.Close()
cStream.Close()
fStream.Close()
Return Value
End Function3.3.Double Click On Crypt and Decrypt And Button1 And Add Those Codes :
Code
Private Sub crypte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles crypte.Click
krypt()
End Sub
Private Sub decrypte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles decrypte.Click
dekrypt()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using o As New OpenFileDialog
o.Filter = ""
o.FileName = TextBox1.Text.Trim
If o.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
TextBox1.Text = o.FileName
End If
End Using
End SubScreeshot :
[img]http://api.ning.com/files/IxHb7n6sH4kMMFnjHfdF8Q5rY1tZf9H7G3DeOemSg*ox1*QIQJHP9fBI7JiMN5QeQLL2jU-orsCuM07xidw9g8YoR-*9fFy-/Untitled1.gif[/img]



