Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Use base64-encoding in favor of hex-encoding #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkging/embed/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package embed
import (
"bytes"
"compress/gzip"
"encoding/hex"
"encoding/base64"
"io"

"github.com/markbates/pkger/here"
)

func Decode(src []byte) ([]byte, error) {
dst := make([]byte, hex.DecodedLen(len(src)))
_, err := hex.Decode(dst, src)
dst := make([]byte, base64.RawStdEncoding.DecodedLen(len(src)))
_, err := base64.RawStdEncoding.Decode(dst, src)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -44,7 +44,7 @@ func Encode(b []byte) ([]byte, error) {
return nil, err
}

s := hex.EncodeToString(bb.Bytes())
s := base64.RawStdEncoding.EncodeToString(bb.Bytes())
return []byte(s), nil
}

Expand Down