title: Simple Encryption Algorithm
body: <p>I'm working on an elevator project just for fun, it's actually hardware.  But I think this is more of a software question.  I don't need to have this feature, in fact it is completely redundant, but I was curious so I'm adding it anyway so I can learn :P</p>
  
  <p>I have an 8 bit address, 8 bit data bus, and an 8 bit encryption code.
  I have a master and many slave devices.
  The master knows the address of the slaves and knows the encryption code.
  The slaves know their address and the encryption code as well.</p>
  
  <p>I want a really simple algorithm such that:</p>
  
  <p>The master sends "y" where, y = function(data,encryption code)
  The slave receives "y" and can extract data by data = function2(y,encryption code)</p>
  
  <p>I tried playing around with AND, XOR, OR, etc... and combinations of them, but couldn't figure it out.</p>
  
  <p>Again I'm looking for simple algorithms.  If you don't mind you could do me a bigger favour and explain some theory on how I can come to such a solution/functions.</p>
  
  <p>Thanks so much!</p>