21 lines
272 B
Go
21 lines
272 B
Go
package cryptography
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"strings"
|
|
)
|
|
|
|
func IsBase64Std(s string) bool {
|
|
if s == "" {
|
|
return false
|
|
}
|
|
|
|
s = strings.TrimSpace(s)
|
|
if len(s)%4 != 0 {
|
|
return false
|
|
}
|
|
|
|
_, err := base64.StdEncoding.Strict().DecodeString(s)
|
|
return err == nil
|
|
}
|