PDA

View Full Version : Cryptography


Holoquin
September 14th, 2007, 07:48 PM
hi,

I am trying to make a program in visual basic 05 that will encrypt video files... So far i have tryed changing its extension to .txt and changed its text -- but when i change it back, it doesn't work.

is there anyone who knows how to encrypt a video file such as avi and mpeg...

Thanks

oracle128
September 16th, 2007, 07:11 AM
Thar be a great deal of work involved for proper cryptography. One cannot just change a binary file to text and back, thar be no way of representin' a binary file as ASCII. A lubber would 'ave t' encrypt the binary data itself.

If ye want to create ye own encryption mechanism, that be just dandy, but I hope yer maths is top notch. Otherwise, it be best to utilize an existing encryption library, such as AES or Blowfish.

Holoquin
September 16th, 2007, 02:53 PM
Thanks for the reply

I downloaded a hex/binary viewer so i can view any file in hex/binary, i can then change the values which make the video unreadable and then change them back again so it works...

That is great but i will have to pay for the program after 30 days-- is there away to view/edit your file in binary without using special software...

Second, how do i view and edit the files binary in vb 2005?

Thanks again

oracle128
September 16th, 2007, 07:56 PM
That is great but i will have to pay for the program after 30 days-- is there away to view/edit your file in binary without using special software...It be not possible to view nor edit ye binary data without a hex editor. Howe'er, there be many a free hex editor if ye search throughout the high seas. Why, even me first mate PSPad (http://www.pspad.com/) can hex edit. Though, ye'd be doin' well to find a hex editor which won't keel at the site of a large sea-monster file.

Second, how do i view and edit the files binary in vb 2005?'Ere be two sample VB projects that demonstrate hex editing of binary files. Ye best follow th' example of these buccaneers if ye wants t' be directly editing binary files.
http://www.freevbcode.com/ShowCode.asp?ID=1900
http://www.singlix.org/download/bfe.html

But as me said, editing binary be no "encryption", and any scurvy dog could read ye treasure maps without even tryin'. If ye wants proper encryption of th' locations of ye prized booty, ye best to use an existing encryption library.
http://www.di-mgt.com.au/crypto.html#BlowfishVB

Holoquin
September 17th, 2007, 05:00 PM
Well it took me a while but i finally came up with a working solution to my problem -- was very simple...



Dim filename As String = "C:\users\videofile.mpeg" 'File to edit
Dim filewrite As String = "C:\users\cyphervideo.txt" 'Save edit version to

Dim file() As Byte 'byte array

file = My.Computer.FileSystem.ReadAllBytes(filename) 'Get all bytes from file and store in byte array

'Edit/encrypt *or* edit-back/de-crypt bytes here


My.Computer.FileSystem.WriteAllBytes(filewrite, file, False) 'Write modified bytes




This works perfectly.... and i know just editing one or two bytes isn't encryption but i needed to know that i could edit them first and put them back as that would show i was editing it in the correct format... before i put them into my own encryption system...