Skip to content

Commit

Permalink
Merge pull request #72 from cyriltovena/fix-reset
Browse files Browse the repository at this point in the history
Reset hashtable during Writer reset to ensure deterministic output.
  • Loading branch information
pierrec committed Apr 29, 2020
2 parents 65e4285 + f5d4b63 commit e876bbd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package lz4
import (
"encoding/binary"
"fmt"
"github.com/pierrec/lz4/internal/xxh32"
"io"
"runtime"

"github.com/pierrec/lz4/internal/xxh32"
)

// zResult contains the results of compressing a block.
Expand Down Expand Up @@ -370,6 +371,10 @@ func (z *Writer) Reset(w io.Writer) {
z.checksum.Reset()
z.idx = 0
z.err = nil
// reset hashtable to ensure deterministic output.
for i := range z.hashtable {
z.hashtable[i] = 0
}
z.WithConcurrency(n)
}

Expand Down

0 comments on commit e876bbd

Please sign in to comment.