Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Meredith Lancaster <[email protected]>
  • Loading branch information
malancas committed May 8, 2023
1 parent 6ba41ba commit 6aafdb2
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions pkg/tests/build_test_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"crypto"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"math/big"
"testing"

Expand All @@ -29,21 +27,8 @@ import (
)

func createBase64EncodedArtifactHash(artifact []byte, hash crypto.Hash) (string, error) {
r := bytes.NewReader(artifact)
h := hash.New()

b := make([]byte, h.Size())
for {
n, err := r.Read(b)
if err == io.EOF {
break
}

_, err = h.Write(b[:n])
if err != nil {
return "", fmt.Errorf("failed to create hash")
}
}
h.Write(artifact)
artifactHash := h.Sum(nil)

return base64.StdEncoding.EncodeToString(artifactHash), nil
Expand Down

0 comments on commit 6aafdb2

Please sign in to comment.