aboutsummaryrefslogtreecommitdiff
path: root/zsig
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-05-01 16:00:22 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-05-01 16:00:22 +0200
commita627541800a5c088d5db6d50bcedb85e1728ce81 (patch)
tree4be525ee1e6495b4585b45d76f4660eef61601fc /zsig
parent88174d478ef6f6bab2f6d4e506a84dbb7d9d93ea (diff)
blocksize
Diffstat (limited to 'zsig')
-rw-r--r--zsig/sum.go7
-rw-r--r--zsig/zsig.go2
2 files changed, 6 insertions, 3 deletions
diff --git a/zsig/sum.go b/zsig/sum.go
index 7d706e8..846a140 100644
--- a/zsig/sum.go
+++ b/zsig/sum.go
@@ -6,11 +6,14 @@ import (
)
// Sum calculates SHA512/256
-func Sum(r io.Reader) chan []byte {
+func Sum(r io.Reader, blockSize int) chan []byte {
c := make(chan []byte, 1)
+ if blockSize == 0 {
+ blockSize = BlockSize
+ }
go func() {
defer close(c)
- buf := make([]byte, BlockSz)
+ buf := make([]byte, blockSize)
for {
n, err := io.ReadFull(r, buf)
if err == io.EOF {
diff --git a/zsig/zsig.go b/zsig/zsig.go
index ae2eb01..6c7c16a 100644
--- a/zsig/zsig.go
+++ b/zsig/zsig.go
@@ -22,7 +22,7 @@ const (
flagComment = 1 << 4
)
-const BlockSz = 65536
+const BlockSize = 65536
var fake = []byte{gzipID1, gzipID2, gzipDeflate, flagComment, 0, 0, 0, 0, 0, 3}