Article Preview
Buy Now
| Print: | |
| PDF: |
Beyond the Limits
Stego Part II
Issue: 1.5 (April/May 2003)
Article Description: No description available.
Article Length (in bytes): 9,885
Starting Page Number: 46
RBD Number: 1525
Resource File(s): None
Related Link(s): None
Known Limitations: None
Excerpt of article text...
In the previous column we set up a basic steganographic engine that encoded pictures and text files inside PICT files. We are going to improve this engine along the following lines:
* faster encoding/decoding;
* secure encoding scheme;
* accept more file types, including files with resource forks;
* storage of multiple files.
Last time I gave you a hint regarding improving the speed of the engine: MemoryBlocks. When manipulating arbitrary data, like in this case, MemoryBlocks are, if not convenient, much faster than strings. They require more care when dealing with them, but the impact on speed is remarkable. Whenever you have to manipulate arbitrary data, use MemoryBlocks.
Last time, we put the data in strings, parsed it, and split it over the pixels of a picture. While a little more cumbersome, using MemoryBlocks instead will prove much faster. Here is the basic principle. Let's assume that mm is a MemoryBlock containing the data stream we want to encode. Each byte to be encoded can be retrieved by mm.Byte(pointer), pointer being just that: a position pointer to the MemoryBlock. This returns an integer, which makes the speed improvement twice as great since it replaces two string functions: Asc(Mid(s,i,1)). This was quite expensive, since we had to retrieve the byte to encode (mid) and then convert it to an integer. Instead of that, one call to a MemoryBlock does it all.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|










