* - 187Modz - Sep 4, 2010
nice work, looks good, probably wont use it myself, but seems like many others will
* - From KSA with lag - Sep 4, 2010
(Sep 3, 2010 08:09 PM)kobac Wrote: Simple way to store data as real image :D
[img]http://img818.imageshack.us/img818/9107/imagecrypt.gif[/img]
[img]http://img130.imageshack.us/img130/5156/imagesha.png[/img]
Crypt:
Code Function pixelator(ByVal a As String) As Image
a = Convert.ToBase64String(New System.Text.UTF8Encoding().GetBytes(CompressString(a)))
Dim imageholder As Bitmap
Dim autosize As Integer = System.Math.Sqrt(a.Count) + 2
imageholder = New Bitmap(autosize, autosize)
Dim G As Graphics = Graphics.FromImage(imageholder)
Dim fff As Integer = 0
While fff <= a.Count - 1
For Y = 1 To imageholder.Height - 1
For X = 1 To imageholder.Width - 1
If fff <= a.Count - 1 Then
imageholder.SetPixel(X, Y, Color.FromArgb(Convert.ToInt32(a.Chars(fff)), 0, 0))
fff = fff + 1
End If
Next X
Next Y
End While
Return imageholder
DeCrypt:
Code Function depixelator(ByVal a As Image) As String
Dim retrievestr As String = ""
Dim xmax As Integer
Dim ymax As Integer
xmax = a.Width - 1
ymax = a.Height - 1
For y = 1 To ymax
For x = 1 To xmax
With CType(a, Bitmap).GetPixel(x, y)
retrievestr = retrievestr & Convert.ToChar(.R)
End With
Next x
Next y
retrievestr = New System.Text.UTF8Encoding().GetString(Convert.FromBase64String(retrievestr.Replace(Convert.ToChar(0), "")))
retrievestr = DecompressString(retrievestr)
Return retrievestr
End Function
Needed Functions:
Code Public Shared Function CompressString(ByVal text As String) As String
Dim buffer__1 As Byte() = Encoding.UTF8.GetBytes(text)
Dim memoryStream = New IO.MemoryStream()
Using gZipStream = New IO.Compression.GZipStream(memoryStream, CompressionMode.Compress, True)
gZipStream.Write(buffer__1, 0, buffer__1.Length)
End Using
memoryStream.Position = 0
Dim compressedData = New Byte(memoryStream.Length - 1) {}
memoryStream.Read(compressedData, 0, compressedData.Length)
Dim gZipBuffer = New Byte(compressedData.Length + 3) {}
Buffer.BlockCopy(compressedData, 0, gZipBuffer, 4, compressedData.Length)
Buffer.BlockCopy(BitConverter.GetBytes(buffer__1.Length), 0, gZipBuffer, 0, 4)
Return Convert.ToBase64String(gZipBuffer)
End Function
Public Shared Function DecompressString(ByVal compressedText As String) As String
Dim gZipBuffer As Byte() = Convert.FromBase64String(compressedText)
Using memoryStream = New IO.MemoryStream()
Dim dataLength As Integer = BitConverter.ToInt32(gZipBuffer, 0)
memoryStream.Write(gZipBuffer, 4, gZipBuffer.Length - 4)
Dim buffer = New Byte(dataLength - 1) {}
memoryStream.Position = 0
Using gZipStream = New GZipStream(memoryStream, CompressionMode.Decompress)
gZipStream.Read(buffer, 0, buffer.Length)
End Using
Return Encoding.UTF8.GetString(buffer)
End Using
End Function
Simple Usage:
Code Crypt: PictureBox1.Image = pixelator(RichTextBox1.Text)
DeCrypt: RichTextBox1.Text = depixelator(PictureBox1.Image)
Source: http://www.mediafire.com/download.php?4bwdc49ib98nz59
Update: (using png image format, file can be uploaded to imageshack)
code(png):
Code Imports System.Text
Imports System.IO.Compression
'By Kobac
Public Class Form1
Function pixelator(ByVal a As String) As Image
a = Convert.ToBase64String(New System.Text.UTF8Encoding().GetBytes(CompressString(a)))
Dim imageholder As Bitmap
Dim autosize As Integer = System.Math.Sqrt(a.Count) + 2
imageholder = New Bitmap(autosize, autosize)
Dim G As Graphics = Graphics.FromImage(imageholder)
Dim fff As Integer = 0
While fff <= a.Count - 1
For Y = 1 To imageholder.Height - 1
For X = 1 To imageholder.Width - 1
If fff <= a.Count - 1 Then
imageholder.SetPixel(X, Y, Color.FromArgb(Convert.ToInt32(a.Chars(fff)), 0, 0))
fff = fff + 1
End If
Next X
Next Y
End While
Return imageholder
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Image = pixelator(RichTextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RichTextBox1.Text = depixelator(PictureBox1.Image)
End Sub
Function depixelator(ByVal a As Image) As String
Dim retrievestr As String = ""
Dim xmax As Integer
Dim ymax As Integer
xmax = a.Width - 1
ymax = a.Height - 1
For y = 1 To ymax
For x = 1 To xmax
With CType(a, Bitmap).GetPixel(x, y)
retrievestr = retrievestr & Convert.ToChar(.R)
End With
Next x
Next y
retrievestr = New System.Text.UTF8Encoding().GetString(Convert.FromBase64String(retrievestr.Replace(Convert.ToChar(0), "")))
retrievestr = DecompressString(retrievestr)
Return retrievestr
End Function
Public Shared Function CompressString(ByVal text As String) As String
Dim buffer__1 As Byte() = Encoding.UTF8.GetBytes(text)
Dim memoryStream = New IO.MemoryStream()
Using gZipStream = New IO.Compression.GZipStream(memoryStream, CompressionMode.Compress, True)
gZipStream.Write(buffer__1, 0, buffer__1.Length)
End Using
memoryStream.Position = 0
Dim compressedData = New Byte(memoryStream.Length - 1) {}
memoryStream.Read(compressedData, 0, compressedData.Length)
Dim gZipBuffer = New Byte(compressedData.Length + 3) {}
Buffer.BlockCopy(compressedData, 0, gZipBuffer, 4, compressedData.Length)
Buffer.BlockCopy(BitConverter.GetBytes(buffer__1.Length), 0, gZipBuffer, 0, 4)
Return Convert.ToBase64String(gZipBuffer)
End Function
Public Shared Function DecompressString(ByVal compressedText As String) As String
Dim gZipBuffer As Byte() = Convert.FromBase64String(compressedText)
Using memoryStream = New IO.MemoryStream()
Dim dataLength As Integer = BitConverter.ToInt32(gZipBuffer, 0)
memoryStream.Write(gZipBuffer, 4, gZipBuffer.Length - 4)
Dim buffer = New Byte(dataLength - 1) {}
memoryStream.Position = 0
Using gZipStream = New GZipStream(memoryStream, CompressionMode.Decompress)
gZipStream.Read(buffer, 0, buffer.Length)
End Using
Return Encoding.UTF8.GetString(buffer)
End Using
End Function
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim save1 As New SaveFileDialog()
If save1.ShowDialog() = DialogResult.OK Then
Dim bm As Bitmap = CType(PictureBox1.Image, Bitmap)
bm.Save(save1.FileName & ".png", System.Drawing.Imaging.ImageFormat.Png)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Using open As New OpenFileDialog
If open.ShowDialog = DialogResult.OK Then
Dim bm As New Bitmap(open.FileName)
PictureBox1.Image = bm
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
End If
End Using
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
RichTextBox1.Clear()
End Sub
End Class
what program did you use to make
animated GIF picture ?
* - kobac - Sep 4, 2010
@From KSA with lag Camtasia Studio
* - teampower2 - Sep 4, 2010
good one..
will be helpful..
* - devil0angel - Feb 17, 2011
I like this a lot, used something a long time ago to chat with my friends so no one can know what we were writing to each other. Nice times๐.
Bas mi se svidja sto si ovo uradio, svaka cas samo tako nastavi!๐
* - wir - Feb 17, 2011
Thats so cool
Thanks for the share
* - Ajumma - Feb 17, 2011
Hey this is cool, thanks for the source.
is there a way you can add a password to this?
Like you need a password to unlock the picture?
* - TheDubWubCub - Apr 17, 2011
this is so crazy! i just thoguth of this (kinda differnt way but still same concept) aye well nice job!
* - Ethernal Five - Apr 17, 2011
Nice app, thank you!
toshort lol
* - kas - Apr 17, 2011
thanks, it is very interesting.
Thanks for sharing
* - Vysse - Apr 17, 2011
Trapt had a method of doing this he shared with me awhile back it is pretty nice.
* - MalwareMop - Apr 17, 2011
Great job, Nice release. I'm going to use this. Keep up this kind of work. This is very useful for saving my hacked accounts.
* - GAMEKINGZ - Apr 18, 2011
Really nice bro :D im sure im gonna try this.
* - LuckyLoc - Apr 18, 2011
Great!! This reminds me on Stenography, is it possible to store information in a already existing image?
Greetings L.L.
* - duyan13 - Apr 18, 2011
Hey THanX for this source !!
|