dc wrote:
> Hi list.

Hi.

> I need to encode some data with a userID and then also be able to
> decode it with the same key.
> 
> This is basically a quick approach to obfuscate URLs. Its for an
> environment where we know the users ID with some degree of certainty.
> 
> Are there any libraries/simple algorithms to do this in ruby? it might
> be as simple as bitshiting a string around...

Is "bitshiting" what happens when you eat one byte at a time? :)

> any other suggested alternatives to this approach?

Let your key be an integer.  XOR each byte (or set of bytes) in the
string by the integer to encode.  To decode, XOR them again.  Let me
know if you'd like code.  (Actually, I'd be interested to see other
people's implementations. ;)