baseConvert() & 32-bit ops

Mark Brownell gizmotron at earthlink.net
Sun Jun 22 16:54:01 EDT 2003


On Saturday, June 21, 2003, at 09:39  PM, Dar Scott wrote:

> I'm glad this is working well.
>
> Dar Scott

Dar,

Yep, and thanks for your help. So this speeds things up nicely in one 
of the two rebuilds of the P-box and specially in the 32 bit-at-a-time 
halfBlock cypher sections before the blocks go through the S-boxes.

> There is probably a good URL out there on bit processing.  However, 
> that is something that can be elaborated on the list as we discuss 
> Transcript commands to do things.  This kind of thing is handy in all 
> kinds of binary I/O.  For example, just the other day someone asked 
> about certain file formats.  The answer just might require some work 
> in tweaking bits.

http://www.elitecoders.de/mags/cscene/CS9/CS9-02.html
"Becoming Bit Wise" by Gene Myers

So at the end of encryption I get a byte for byte result that is one of 
255 possible ascii characters. I have choices that I can do with it. I 
can save it as hexadecimal. I could do something with the end process 
before it is numToChared.  It comes down to binary I/O purposes I guess.

If I used zeros to pad then I can strip them based on the number of 
chars in the original, a function may be used to strip these extra 
characters from the end of the string. For binary data I have read that 
the length of the data should be encrypted in a header, so that padding 
characters can be safely removed without accidentally destroying valid 
0's at the end of the data stream. I'm interested in learning more 
about binary distribution techniques. If I compress the encrypted ascii 
text with Revolution's compress feature from a variable will it end up 
being corrupted like it does placing it into a field object and then 
saving that field as plain text. I haven't found anything that suggests 
what to do with I/O in the TD.

In This:

   on convertStuff dataToConvert
     global headerData,placeholder,bodyData,footerData
     put binaryDecode("i5x2a24xi2",dataToConvert, \
        headerData,placeholder,bodyData,placeholder,footerData) \
        into convertResult
     if convertResult < 3 then return "Error: data was corrupted"
   end convertStuff

I'm guessing that 
headerData,placeholder,bodyData,placeholder,footerData all create 
values that can be used. Is that correct? Something tells me that 
"i5x2a24xi2" stands for stuff that comes later.

Note from TD: You must declare or otherwise create all variables in the 
variablesList before using them in the binaryDecode function. Unlike 
the put command, the binaryDecode function does not automatically 
create local variables when you use them.

So, what kinds of text I/O things can be done using Revolution?

Thanks,

Mark







More information about the use-livecode mailing list