# 异或密码

A $\oplus$ 0 = A
A $\oplus$ A = 0
(A $\oplus$ B) $\oplus$ C = A $\oplus$ (B $\oplus$ C)
(B $\oplus$ A) $\oplus$ A = B $\oplus$ 0 = B

 01010111 01101001 01101011 01101001 $\oplus$ 11110011 11110011 11110011 11110011 = 10100100 10011010 10011000 10011010

 10100100 10011010 10011000 10011010 $\oplus$ 11110011 11110011 11110011 11110011 = 01010111 01101001 01101011 01101001

## 伪代码

``` while(done < len) {
tmp_ch = *buffer;
for(int i = 0; i < key_len; i++)
tmp_ch ^= key[i];
*crypted = tmp_ch;
crypted++; buffer++; done++;
}
```

``` while (done <= len) {
tmp_ch = *buffer;
for(int i = key_len-1; i >= 0; i--) {
tmp_ch ^= key[i];
}
*decrypted = tmp_ch;
decrypted++; buffer++; done++;
}
```