Option Strict On Imports System.IO Imports System.IO.Compression Imports System.Security.Cryptography Imports System.Text Public Class Form1 Private WithEvents TxtStatus As New TextBox Private WithEvents BtnTest As New Button Private WithEvents TxtEncryptKey As New TextBox Private Label1 As New Label Private WithEvents BtnLoadFile As New Button Private TxtPlain As New RichTextBox Private RNG As New Random Private CompressedFileName As String Private CompressedLength As Long Private InputFileName As String Private InputLength As Long Private ColorList As New List(Of Color) Private MainBitmap As Bitmap Private EncryptKey As String Private ImageWidth As Integer Private ImageHeight As Integer Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load AutoScaleMode = AutoScaleMode.Font ClientSize = New Size(604, 270) MinimumSize = Size With TxtStatus .Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) Or AnchorStyles.Right), AnchorStyles) .Location = New Point(4, 224) .Multiline = True .Size = New Size(594, 37) End With With BtnTest .Location = New Point(206, 188) .Size = New Size(120, 23) .Text = "Test" End With With TxtEncryptKey .Anchor = CType(((AnchorStyles.Top Or AnchorStyles.Left) Or AnchorStyles.Right), AnchorStyles) .Location = New Point(80, 131) .Size = New Size(518, 22) End With With Label1 .AutoSize = True .Location = New Point(3, 134) .Size = New Size(70, 14) .Text = "Password:" End With With BtnLoadFile .Location = New Point(80, 188) .Size = New Size(120, 23) .Text = "Load A File" End With With TxtPlain .Anchor = CType(((AnchorStyles.Top Or AnchorStyles.Left) Or AnchorStyles.Right), AnchorStyles) .Location = New Point(4, 2) .Size = New Size(594, 123) End With With Me .Controls.Add(TxtPlain) .Controls.Add(BtnLoadFile) .Controls.Add(BtnTest) .Controls.Add(TxtStatus) .Controls.Add(Label1) .Controls.Add(TxtEncryptKey) .Font = New Font("Consolas", 9.0!, FontStyle.Regular, GraphicsUnit.Point, CType(0, Byte)) .Text = "ONLY FOR TESTING " & " " & Application.ProductVersion & " TESTING ONLY" End With End Sub Private Function GetSHA1Color(ByVal Input As String) As Color Dim SHA1Hasher As New SHA1Managed() Dim Hash As Byte() = SHA1Hasher.ComputeHash(Encoding.Default.GetBytes(Input)) Return Color.FromArgb(255, Hash(0), Hash(1), Hash(2)) End Function Private Function FillColorList(EncryptKey As String) As Boolean ColorList.Clear() Dim ColorToAdd As Color = Nothing For CharacterValue As Integer = 0 To 255 ColorToAdd = GetSHA1Color(EncryptKey & Chr(CharacterValue)) If ColorList.Contains(ColorToAdd) Then Return False Else ColorList.Add(ColorToAdd) End If Next Return True End Function Private Sub CompressFileToFile(InFile As String, Outfile As String) Dim InFileInfo As FileInfo = New FileInfo(InFile) Dim InFileLength As Long = InFileInfo.Length Dim Bytesread As Long = 0 Dim BytesRemaining As Long = InFileLength Dim BufferSize As Long = InFileLength \ 100 Dim BytesToRead As Long = BufferSize Dim buffer(CInt(BufferSize - 1)) As Byte Dim OutFileinfo As New FileInfo