mirror of https://github.com/markbates/pkger.git
Use base64-encoding in favor of hex-encoding
This commit is contained in:
parent
0273362499
commit
7a865c80b8
|
@ -3,15 +3,15 @@ package embed
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"encoding/hex"
|
"encoding/base64"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/markbates/pkger/here"
|
"github.com/markbates/pkger/here"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Decode(src []byte) ([]byte, error) {
|
func Decode(src []byte) ([]byte, error) {
|
||||||
dst := make([]byte, hex.DecodedLen(len(src)))
|
dst := make([]byte, base64.RawStdEncoding.DecodedLen(len(src)))
|
||||||
_, err := hex.Decode(dst, src)
|
_, err := base64.RawStdEncoding.Decode(dst, src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ func Encode(b []byte) ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
s := hex.EncodeToString(bb.Bytes())
|
s := base64.RawStdEncoding.EncodeToString(bb.Bytes())
|
||||||
return []byte(s), nil
|
return []byte(s), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue