diff --git a/cmd/xorenc/main.go b/cmd/xorenc/main.go index 1402f1a..d427bb4 100644 --- a/cmd/xorenc/main.go +++ b/cmd/xorenc/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "kumoly.io/lib/xorencrypt" + "kumoly.io/lib/xorenc" ) var Version = "0.0.0" @@ -25,7 +25,7 @@ func main() { return } if len(os.Args) < 3 { - fmt.Println("usage: xorencrypt [e|d] msg key") + fmt.Println("usage: xorenc [e|d] msg key") os.Exit(1) } key := "" @@ -35,9 +35,9 @@ func main() { msg := os.Args[2] if strings.HasPrefix(os.Args[1], "e") { - fmt.Println(xorencrypt.Encrypt(msg, key)) + fmt.Println(xorenc.Encrypt(msg, key)) } else { - str, err := xorencrypt.Decrypt(msg, key) + str, err := xorenc.Decrypt(msg, key) if err != nil { panic(err) } diff --git a/go.mod b/go.mod index 1e378cd..2d94864 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module kumoly.io/lib/xorencrypt +module kumoly.io/lib/xorenc go 1.17 diff --git a/xorencrypt.go b/xorencrypt.go index fee216e..bce0849 100644 --- a/xorencrypt.go +++ b/xorencrypt.go @@ -1,4 +1,4 @@ -package xorencrypt +package xorenc import "encoding/base64" @@ -8,7 +8,7 @@ func Decrypt(msg, key string) (string, error) { if key == "" { key = DEFAULT_KEY } - deb64, err := base64.StdEncoding.DecodeString(msg) + deb64, err := base64.URLEncoding.DecodeString(msg) if err != nil { return "", err } @@ -21,7 +21,7 @@ func Encrypt(msg, key string) string { key = DEFAULT_KEY } enc := xor([]byte(msg), []byte(key)) - return base64.StdEncoding.EncodeToString(enc) + return base64.URLEncoding.EncodeToString(enc) } func xor(msg, key []byte) []byte { diff --git a/xorencrypt_test.go b/xorencrypt_test.go index 149fa8e..17fea41 100644 --- a/xorencrypt_test.go +++ b/xorencrypt_test.go @@ -1,4 +1,4 @@ -package xorencrypt +package xorenc import ( "fmt"