1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-23 00:32:55 +01:00

No need for io.Copy when writing to hash.

This commit is contained in:
Sascha L. Teichmann 2021-12-09 12:21:32 +01:00
parent 907894416f
commit 8e998dd058

View file

@ -1,19 +1,17 @@
package main package main
import ( import (
"bytes"
"crypto/sha256" "crypto/sha256"
"crypto/sha512" "crypto/sha512"
"fmt" "fmt"
"hash" "hash"
"io"
"io/ioutil" "io/ioutil"
"os" "os"
) )
func writeHash(fname, name string, h hash.Hash, data []byte) error { func writeHash(fname, name string, h hash.Hash, data []byte) error {
if _, err := io.Copy(h, bytes.NewReader(data)); err != nil { if _, err := h.Write(data); err != nil {
return err return err
} }