1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +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
import (
"bytes"
"crypto/sha256"
"crypto/sha512"
"fmt"
"hash"
"io"
"io/ioutil"
"os"
)
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
}