baseConvert() & 32-bit ops

Mark Brownell gizmotron at earthlink.net
Sat Jun 21 18:13:00 EDT 2003


On Saturday, June 21, 2003, at 03:26  PM, Dar Scott wrote:

> On Saturday, June 21, 2003, at 03:56 PM, Mark Brownell wrote:
>
>> It has been a very interesting two weeks between the cryptology and 
>> Dar's knowledge of bit processing.
>
> We're a team!!  It is good to see synergy.
>
> I have 1st and 2nd edition of Bruce Schneier's _Applied Cryptography_. 
>  We can point to pages in that if you have one.

I don't have  Bruce Schneier's _Applied Cryptography although I have 
read that it is one of the better books regarding implementation. In 
other words it is more on practical use and less on theoretical math. 
And he did create Blowfish back in 1993 and give it away. Maybe I'll 
get into this later. Right now Dar has opened a whole new world to me 
regarding binary numbers.

> 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.
>
> Dar Scott

> On Saturday, June 21, 2003, at 01:47 PM, Dar Scott wrote:
>
>>> also, not being familiar with binaryEncode how would you write the 
>>> following using binaryEncode?
>>>
>>> put charToNum("F") + (charToNum("o") * 256 ) + ( charToNum("r") * 
>>> 65536 ) + ( charToNum("m") * 16777216 ) into xL
>>
>>   local halfBlock  -- required
>>   put binaryDecode("N","Form",halfBlock) into numConverted
>>
>> In converting strings to blocks use 'char i to (i+3) of plainText' 
>> instead of "Form" and pay attention to the end.  The variable 
>> numConverted with be 0 for short data.
>
> Whoops.  I got the bytes backwards.  Can you live with my order?
>
>   put binaryDecode("N", "m" & "r" & "o" & "F" ,halfBlock) into 
> numConverted
>
> Dar Scott


OK,

I don't understand this: binaryDecode("N", "m" & "r" & "o" & "F" 
,halfBlock)

I don't see what to place into the local variable halfBlock

-- my goal is to end up with this: 1181708909
-- from this:
put charToNum("m") + (charToNum("r") * 256 ) + ( charToNum("o") * 65536 
) + ( charToNum("F") * 16777216 )
-- by using :
> put binaryDecode("N", "m" & "r" & "o" & "F" ,halfBlock)

So what am I missing here?

Mark




More information about the use-livecode mailing list