1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Moved AES regex outside of function so it's only compiled once

This commit is contained in:
Adrian Utrilla
2016-08-22 18:15:00 -07:00
parent 3733347416
commit 1767b0375d

View File

@@ -18,9 +18,10 @@ type EncryptedValue struct {
datatype string
}
var encre = regexp.MustCompile(`^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+),type:(.+)\]`)
func parse(value string) (*EncryptedValue, error) {
re := regexp.MustCompile(`^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+),type:(.+)\]`)
matches := re.FindStringSubmatch(value)
matches := encre.FindStringSubmatch(value)
if matches == nil {
return nil, fmt.Errorf("Input string %s does not match sops' data format", value)
}