Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

is this a xor bug?

 [1/2] from: zokie::libero::it at: 13-Sep-2002 15:08


Hello, two week ago, I had developed a little tools to do Vernam's encoding/decoding. It is a cryptographic algorythm based on XOR. I had tested it for long time on my Rebol/View 1.2.1.3.1 (Windows) and it works fine! Today I had used it on my Rebol/View 1.2.1.1.1 (AmigaOS) and it don't work any more! I had discovered that Rebol's XOR function behaves very different under AmigaOS, Windows 9x, and WinUAE/JIT: Amiga (1.2.1.1.1): c: xor to-binary "cane" to-binary "casa" == #{04001A1C} to-string xor c to-binary "casa" == "}w^F^]" Window (1.2.1.3.1): c: xor to-binary "cane" to-binary "casa" == #{00001D04} to-string xor c to-binary "casa" == "cane" WinUAE/JIT (1.2.1.1.1): c: xor to-binary "cane" to-binary "casa" == #{04000000} to-string xor c to-binary "casa" == "a^@20" It seems to me a bug of 1.2.1.1.1. How do I workaround fastly and cleanly? Kind regards -- "Where did you get all those facts!?!"

 [2/2] from: carl:cybercraft at: 14-Sep-2002 9:46


On 14-Sep-02, Francesco De Napoli wrote:
> Hello, > two week ago, I had developed a little tools to do Vernam's
<<quoted lines omitted: 21>>
> It seems to me a bug of 1.2.1.1.1. How do I workaround fastly and > cleanly?
Hi Francesco, Yes, it does seem to be a bug in the Amiga versions of REBOL. And with all the logic functions when combined with binary I suspect. This from View...
>> xor #{0000} #{0000}
== #{2036}
>> xor #{0000} #{0000}
== #{6033}
>> xor #{0000} #{0000}
== #{6033}
>> xor #{0000} #{0000}
== #{2033}
>> xor #{0000} #{0000}
== #{2033}
>> xor #{0000} #{0000}
== #{E033}
>> xor #{0000} #{0000}
== #{E033}
>> xor #{0000} #{0000}
== #{2033}
>> 2#{00000000} xor 2#{00000000}
== #{60}
>> 2#{00000000} xor 2#{00000000}
== #{60}
>> 2#{00000000} xor 2#{00000000}
== #{20}
>> 2#{00000000} xor 2#{00000000}
== #{20}
>> 2#{00000000} xor 2#{00000000}
== #{E0}
>> #{0000} xor #{0000}
== #{E04C}
>> #{0000} xor #{0000}
== #{2034}
>> #{0000} xor #{0000}
== #{E033}
>> #{0000} xor #{0000}
== #{E033}
>> #{0000} and #{0000}
== #{9400}
>> #{0000} and #{0000}
== #{0400}
>> #{0000} and #{0000}
== #{9400}
>> #{0000} and #{0000}
== #{0400}
>> #{0000} and #{0000}
== #{1400}
>> #{0000} and #{0000}
== #{0400}
>> about
REBOL/View 1.2.1.1.1 21-Jun-2001 Very odd that the results are sort of random... A possible solution would be to loop through your strings XORing them at the char level, as that seems to give the right answer...
>> b: xor #"a" #"z"
== #"^["
>> xor b #"z"
== #"a" HTH. -- Carl Read

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted