Gencrypt is a Go package that acts as a wrapper around portions of the standard libraries crypto package. It depends on only the standard library and is very small at only 40 lines (uncommented, not including tests). Based on George Tankersley's talk at Gophercon 2016.
package main
import (
"fmt"
"github.com/btcsuite/btcutil/base58"
"github.com/attiliodrei/gencrypt"
)
// NOTE: Error checking not handled in this example but should be in
// production.
var (
// Data you want to encrypt
data = []byte("/restreamer/footters_client/footters-27/restreamer/hls/UGE8b2g/")
// Secret key. A 32-byte key is used to indicate AES-256. 16 and 24-byte keys
// are accepted for AES-128 and AES-192 respectively, but are not
// recommended.
key = []byte("12345678901234561234567890123456")
)
func main() {
// Get the GCM
gcm, _ := gencrypt.NewGCM(key)
// Encrypt data
enc, _ := gcm.AESEncrypt(data)
b58enc := base58.Encode([]byte(enc))
fmt.Println(string(b58enc))
// Decrypt data
dec, _ := gcm.AESDecrypt(base58.Decode(b58enc))
fmt.Println(string(dec))
}
[0] https://en.wikipedia.org/wiki/AES_instruction_set#New_instructions
[1] https://blog.gopheracademy.com/advent-2016/exposing-go-on-the-internet/