http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gameprogrammer] RES: Re: XOR Problem



Thank you very much!!! It worked perfectly!!

-----Mensagem original-----
De: gameprogrammer-bounce@freelists.org
[mailto:gameprogrammer-bounce@freelists.org] Em nome de Dave Slutzkin
Enviada em: segunda-feira, 7 de maio de 2007 01:25
Para: gameprogrammer@freelists.org
Assunto: [gameprogrammer] Re: XOR Problem

On Sun, 6 May 2007 16:36:34 -0300, "Edilson Vasconcelos de Melo Junior"
<dirso@jrsoftwares.com.br> said:
>             for (string::iterator i = Text.begin(); i != Text.end(); i++)
> 
>             {
> 
>                   letter = code | *i;

Shouldn't this line be:

letter = code ^ *i;

You still want to xor it to get it back to its original state, that's
the whole point.

Have a look at the attached one for a cleaned up version of your code.

Dave.
-- 
  Dave Slutzkin
  Melbourne, Australia
  daveslutzkin@fastmail.fm



---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html