To add to what Richard says: Even if it worked, AND is a bad idea from an encryption point of view.
If you AND two one bit values:
A-> 0 1
| 0 0 0
V 1 0 1
You only have two results: zero and one. And three of them are zero, so you have no way to tell from the result what the original inputs were, even if you know one of them! If
A == 0
, then both
B == 0
B == 1
generate the same output, so you cannot "decrypt" your output and get your original value.
The same thing happens with a binary AND: each bit-pair in the two inputs is combined, and you can't work out what you started with even if you know the result and either A or B.
XOR is the only
two value binary operation that can be reversed (or "decrypted").
And to be honest, even if you use XOR, your encrypted data is going to be ... unsafe. As in "very easy to crack".
If you want to encrypt strings, look at DES or similar: .NET includes implementations which need very little effort on your part and are miles stronger than anything a non-expert could produce.