Re: Need XOR solution
Re: Need XOR solution
- Subject: Re: Need XOR solution
- From: "Marc K. Myers" <email@hidden>
- Date: Tue, 06 Aug 2002 22:22:57 -0400
- Organization: [very little]
>
Date: Tue, 06 Aug 2002 16:33:17 -0400
>
Subject: Re: Need XOR solution
>
From: "Arthur J. Knapp" <email@hidden>
>
To: <email@hidden>
>
>
> Date: Mon, 05 Aug 2002 18:45:28 -0400
>
> From: "Marc K. Myers" <email@hidden>
>
> Subject: Need XOR solution
>
>
> Does anyone know of a reasonably fast way to XOR blocks of data together?
>
>
No, but I know of "a" way to perform vanilla XORing, unfortunately a
>
"reasonably fast" way to do it alludes me.
[...snip!...]
>
> ... I would appreciate it
>
> if someone could point me in the right direction.
>
>
This is unlikely to be the right direction, but you may find
>
my "manual" XORing to be interesting:
[...snip!...]
>
on Bitify(n)
>
return {n div 128 mod 2 `
>
, n div 64 mod 2 `
>
, n div 32 mod 2 `
>
, n div 16 mod 2 `
>
, n div 8 mod 2 `
>
, n div 4 mod 2 `
>
, n div 2 mod 2 `
>
, n mod 2}
>
end Bitify
[...snip!...]
>
on CharXOR(a, b)
>
set o to text item delimiters
>
set aa to my Bitify(my AsciiNumber_t(a))
>
set bb to my Bitify(my AsciiNumber_t(b))
>
set text item delimiters to o
>
set cc to my Xorify(aa, bb)
>
return my AsciiCharacter(my Numify(cc))
>
end CharXOR
I find it more than interesting; I find it mind-boggling. I've printed
it out and will attempt to understand it gradually at my leisure. I
really like the "Bitify" routine which is much simpler than the one I
was playing with to get bytes as bit patterns.
One thing I definitely don't understand at this point is why you use the
"my" preceeding the handler calls. I tried the script with all the
"my"s removed and got the same results. Aren't handler calls always
processed at the script level unless they're in a tell block?
Thanks for the help.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/6/02 10:18:36 PM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.