Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hello, I hope someone can help me...

I am writing a program to create a unique cypher of mine, but I have hit a rather nasty snag. I am trying to convert the letters into corresponding jpeg files I have on my hard-drive. The problem I have is two fold.

1: I do not know the visual basic coding to put images into a microsoft word document. (I am using VB 6.5 that came with the student version of microsoft office 2007)

2: I want to make it a back up of a single image instead of an alterable multi-jpeg document (the document itself will be made up of multiple jpegs for reverse conversion). Is there a way to do this?

I will greatly appreciate any help that is given.
Posted
Updated 14-Jan-11 8:51am
v2
Comments
OriginalGriff 14-Jan-11 14:43pm    
This may sound like a stupid question, but are you seriously trying to replace each individual letter from an input by a .JPG image in a word document?

If so: Are you completely barking? Have you worked out just how big the en-cyphered file is going to be?

If not: please try to explain better what you are trying to do!
Jameswins 14-Jan-11 14:55pm    
Yes I am replacing each individual letter. No I am not barking mad. Yes I have figured how large it is going to be. Also the individual jpegs are not large, less than a quarter of an inch on standard resolution. Plus, I have factored out a lot of different aspects of the text and it should not be a problem for size since the documents are not intended to be novels.

I just need the code so please keep criticism to a minimum.
Dave Kreskowiak 14-Jan-11 15:13pm    
It wasn't the size of the JPEG's he was talking about, rather the size of the Word document on disk after you get done replacing all those letters with pictures.

This sounds completely impractical. What are the concepts behind your "cypher"? I don't get what you're really trying to do nor why.
Chris Maunder 15-Jan-11 6:38am    
How many times has a developer been tasked with something impractical? I'd say either help the poor suffering guy or move on.
Jameswins 16-Jan-11 21:36pm    
Thank you Maunder.

You can use Digital watermarking[^] as a starting point for researching you problem, embedding secure information in images is, as you will discover, an "advanced" topic. You'll probably find that jpeg isn't the easiest format to use for this purpose - since it's not lossless, try png instead.

You'll probably find that moving to .Net will make the development phase easier, so to avoid some of the "pain" upgrade to Visual Studio® 2010 Express[^] - You'll have access to the .Net framework, a far richer environment that VB 6.5.

2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies[^] allows you to work with Word and the other office applications.

Now .Net provides a fairly rich api for working with graphics, including png files, or jpeg if you want to use that format. See System.Drawing.Graphics[^] and System.Drawing.Bitmap[^]

As OriginalGriff points out, OCR software can easily convert images to text - but I'll not say that it's a worthless effort, it depends on what you are going to use it for.

If you are serious about this - you have a lot of reading to do.

Regards
Espen Harlinn
 
Share this answer
 
This cypher is a complete waste of your time, and effort. Please, abandon your efforts on this, and concentrate on something more worthwhile.

1) It is a substitution cypher. Regardless of the fact that you are using images to substitute for characters, it could be broken by a ten year old in almost no time at all. Security? None in practical terms.
2) Do you rally think that using images instead of text improves your security? I have free software on my HDD, that is for recovering images from Camera memory cards. It looks at all the raw data on the card, and works out what might be an image, and extracts them into an ordered list. It works. Feed it your Word document, and it will extract the images just as well, I suspect.
3) It is not just the image size that makes this a silly idea: Word also adds on it's own layer of "stuff" around each picture you insert, to tell it where it is to be placed, what the frame looks like, how text should wrap round it, etc., etc. Some quick testing with a 883 byte 1/4" x 1/4" jpeg showed that each file added to a word document increased the file size by 1.5K. So each "character" in your input data takes 1,500 bytes to store in a low security format...

It really isn't worth doing: use the .NET built in security (see the System.Security.Cryptography namespace[^] for details. These are high security, proven methods which are easier to use, and produce a better, smaller result than your cypher.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900