From 90cd8b7b4773edeeb64a3f4160beadb95e26efe7 Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Sat, 28 Feb 2015 15:51:33 -0800 Subject: [PATCH] Adding streaming sha512 --- pkg/utils/crypto/sha512/sha512.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/utils/crypto/sha512/sha512.go b/pkg/utils/crypto/sha512/sha512.go index b06109d17..24d37f603 100644 --- a/pkg/utils/crypto/sha512/sha512.go +++ b/pkg/utils/crypto/sha512/sha512.go @@ -175,3 +175,13 @@ func Sum(reader io.Reader) ([]byte, error) { } return h.Sum(nil), nil } + +func SumStream(reader io.Reader) ([Size]byte, error) { + var returnValue [Size]byte + sumSlice, err := Sum(reader) + if err != nil { + return returnValue, err + } + copy(returnValue[:], sumSlice) + return returnValue, err +}