|
- package s3
-
- import (
- "encoding/base64"
- "fmt"
- )
-
- func DecodeBase64Hash(hash string) ([]byte, error) {
- hashBytes := make([]byte, 32)
- n, err := base64.RawStdEncoding.Decode(hashBytes, []byte(hash))
- if err != nil {
- return nil, err
- }
- if n != 32 {
- return nil, fmt.Errorf("invalid hash length: %d", n)
- }
-
- return hashBytes, nil
- }
|