Re: Byte Array Speed

From: Bob O`Bob (filterbob_at_yahoogroups.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 14:56:09 -0700

YYZ wrote:
>
> "Karl E. Peterson" <karl@mvps.org> wrote in message
> news:O8TOYTiLEHA.268@TK2MSFTNGP10.phx.gbl...
> > To see what I did, grab MapFile.zip from http://www.mvps.org/vb/samples.htm
> (ignore
> > the description that says no demo is included <g>).
>
> Okay, I'm going to show my total ignorance of encryption here. I downloaded
> your sample (love to see code from people whom I respect their experience) and
> it works great. But how? What I mean is, I told it to encrypt a file. It did.
> Then I realized I didn't see a "Decrypt" option anywhere. I thought to myself,
> hell, it's already trashed, lets do it again" and this time it decrypted it.
>
> Is this something like ROT13? Just wondering...

In the sense that you're asking, yes.
Exactly like ROT-13, in that an identical pass can reverse an earlier one.

Quite unlike ROT-13, though, in that you can pick keys, rather than leave it
to be easily uncoded by anyone who knows the algorithm.

And here's another interesting bit - you can 'encode' multiple times, using
different keys, and if you 'decode' with those same keys it won't matter
whether the order was the same, reversed, or random.

Also if you do encode with multiple keys, it should be possible to construct
a single key to decode - but that key might have to be very long - up to the
product of the lengths of all the encode keys.

Though using the test apps which have been posted so far, it can be awkward
to use keys that aren't text. Here are some changes to mine which permit
reading the key in from a dropped file:

======
Private lockchange As Boolean

Private Sub Text1_Change()
    If lockchange Then Exit Sub
    Password = Text1.Text
End Sub

Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, _
                Button As Integer, Shift As Integer, X As Single, Y As Single)
    Password = GetFile(Data.Files(1))
    lockchange = True
        Text1.Text = "*** key from file: " & Data.Files(1)
    lockchange = False
End Sub
======

AND in Text2_OLEDragDrop, the line which formerly read Text1.Text is removed.

After making these changes, I verified, as an example, that a file encoded
with both "one" and "three" (in either order) can be decoded in a single step,
using a key fifteen characters long, hex value 1B06170A0B11071C000A1A0D1D0B00

To generate such a key, simply repeat each of the input keys, whole, as many
times as it takes to get strings of the exact same length, and encode those
together.

In this example, that's "oneoneoneoneone" and "threethreethree" and then
encode either one using the other.

        Bob

--

Quantcast