xored

Mark Wieder mwieder at ahsoftware.net
Sun Apr 30 20:54:22 EDT 2006


Alex-

Sunday, April 30, 2006, 3:20:37 AM, you wrote:

> Just do the same thing again .... xor "reverses" itself

Yes - I love xor.

function EncodeOrDecode pString, pKey
  local tNewStr

  repeat for each char c in pString
    put numToChar((charToNum(c)) bitXor pKey) after tNewStr
  end repeat
  return tNewStr
end EncodeOrDecode

...and you can see if it works by

put EncodeOrDecode(EncodeOrDecode("somestring", 90),90) is "somestring"

Back in the Jurassic mists when I was first learning about assembly
language I fell in love with xor. It's still my favorite opcode.

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list