Ambrosia Garden Archive
    • attn: andrew. Re: simplecrypt


      Andrew-

      I was hoping you could explain how the EV pilot file is encrypted. I know that the seed 0xabcd1234 is used and that there are various exclusive ORs done with 0xdeadbeef, that the resource size is used, and that there seem to be left and right bit shifts going on, but for the most part I'm in the dark.

      Is there documentation available, or are you willing to explain what's going on?

      -STH

      ------------------

      (This message has been edited by seant (edited 10-25-2000).)

    • Quote

      Originally posted by seant:
      **Andrew-

      I was hoping you could explain how the EV pilot file is encrypted. I know that the seed 0xabcd1234 is used and that there are various exclusive ORs done with 0xdeadbeef, that the resource size is used, and that there seem to be left and right bit shifts going on, but for the most part I'm in the dark.

      Is there documentation available, or are you willing to explain what's going on?
      **

      It's basically just scrambling the bits in the pilot file in a simple, quick, non-destructive way. In other words, if you run SimpleCrypt on the same data twice, you'll end up with the original.

      Any specific questions, ask away.

      ------------------
      Andrew Welch / el Presidente / Ambrosia Software, Inc.
      (url="http://"http://www.AmbrosiaSW.com/~andrew/")http://www.AmbrosiaSW.com/~andrew/(/url)

    • Quote

      Originally posted by andrew:
      **Any specific questions, ask away.
      **

      Wow. Um. I was kinda hoping you'd point me to a well annotated piece of C or some documentation, but ok, here goes....

      Just so you know what I'm trying to do: I want to make an applescript that dumps pilot file info to a tab deliminated text file for use with spreadsheets (similar to the applescripts I made that do the same thing for EV plugs and data files). Yes, the pilot file has lots of data, but that's ok. I wouldn't need to export all of it at once.

      Anyway, the only example of SimpleCrypt I've seen in action is the the EVDeEncryptor C source(http://www.ambrosias...tor10d1.sit.hqx). I don't know C, but can vaguely see what is going on in the crucial part, but don't entirely understand it. I'm afraid I only know some scripting languages, so please forgive me if I use terms incorrectly 🙂

      I was going to paste the crucial chunk here, but ftp.ambrosiasw.com isn't cooperating. From memory:

      theResource= the resource, I'm assuming in hex
      resSize= the resource size. What does this mean? # characters? Number bits?
      magicNumb=0xABCD1234. Fine. It's a hex number. I think it = -1412623820
      *vPtr=*theResource. I know it's a pointer, but am not sure what's going on.
      for (i=resSize/4; i<0; i--) I grock.
      *(vPtr++)^=magicNumb Huh? The pointer is adding one to itself, and then doing a bitwise exclusive OR, but I don't understant what the pointer is actually pointing to. The whole resource? The first four bits of the resource? I suspect that it's pointing to the first four bits in the file (ABCD1234) at the start of the loop, but during n+1 times through the loop, is it comparing the next block of 4 bits to magicNumb? I'm confused.
      magicNumb=magicNumb+0xDEADBEEF Fine. No problems
      magicNumb^=0xDEADBEEF Again, I understand.

      Here's where my memory breaks down. I know there is a right bitshift (>>24) and then a left bitshift (<<8), but don't remember clearly.

      Anyway, the first part, as I said, makes sense to me looking at the starting hex in a pilot file:
      startVal=0xABCD1234 when looking at a virgin pilot file
      magicNumb=0xABCD1234
      therefore
      startVal^=magicNumb would be all zeros.
      magicNumb=magicNumb+0xDEADBEEF would equal 0xDEADBEEF
      magicNumb^=0xDEADBEEF would equall all zeros.

      This is why the start of the pilot file = ABCD1234 and the decrypted values are 00, 00, 00, 00

      Beyond understand this, I'm lost. Sorry this is kind of random. I know so little that I don't even know the questions to ask :frown:

      -STH

      ------------------

    • (quote)Originally posted by seant:
      **Beyond understand this, I'm lost. Sorry this is kind of random. I know so little that I don't even know the questions to ask:)

      ------------------
      Andrew Welch / el Presidente / Ambrosia Software, Inc.
      (url="http://"http://www.AmbrosiaSW.com/~andrew/")http://www.AmbrosiaSW.com/~andrew/(/url)
      **

    • Quote

      Originally posted by andrew:
      **Well, when you think of the question to ask, do so.:)
      **

      I thought I did:

      Quote

      Originally posted by seant:
      ***(vPtr++)^=magicNumb Huh? The pointer is adding one to itself, and then doing a bitwise exclusive OR, but I don't understant what the pointer is actually pointing to. The whole resource? The first four bits of the resource? I suspect that it's pointing to the first four bits in the file (ABCD1234) at the start of the loop, but during n+1 times through the loop, is it comparing the next block of 4 bits to the new and improved magicNumb? I'm confused.
      **

      -STH

      ------------------