2021-11-17 01:46:39 +00:00
|
|
|
# XOR Encrypt
|
|
|
|
|
|
|
|
a simple xor encryption that encodes to base64 for url safe
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```go
|
|
|
|
msg := "test"
|
|
|
|
key := "key"
|
|
|
|
enc := Encrypt(msg, key)
|
|
|
|
dec, _ := Decrypt(enc, key)
|
|
|
|
fmt.Printf("%s -> %s -> %s\n", msg, enc, dec)
|
2021-11-17 02:44:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Helper cli
|
|
|
|
|
|
|
|
```shell
|
|
|
|
usage: xorenc [e|d] msg key
|
|
|
|
|
|
|
|
$ xorenc e test secret
|
|
|
|
BwAQBg==
|
|
|
|
|
|
|
|
$ xorenc d BwAQBg== secret
|
|
|
|
test
|
|
|
|
```
|
|
|
|
|
|
|
|
### Install
|
|
|
|
|
|
|
|
```sh
|
|
|
|
sudo rm -f /usr/local/bin/xorenc
|
|
|
|
sudo sh -c "curl -fsSL RELEASE_URL | tar -C /usr/local/bin/ -xz"
|
2021-11-17 01:46:39 +00:00
|
|
|
```
|