Skip to content

Commit

Permalink
replace sha256 with crc32 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
PoorlyDefinedBehaviour authored Jul 25, 2024
1 parent 85cd1e9 commit c65f9e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package snapshot
import (
"bytes"
"compress/gzip"
"crypto/sha256"
"encoding/binary"
"encoding/json"
"errors"
"fmt"
"hash/crc32"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -202,7 +202,7 @@ type partition struct {
}

func computeBufferChecksum(buffer []byte) (string, error) {
hash := sha256.New()
hash := crc32.NewIEEE()
bytesWritten, err := hash.Write(buffer)
if err != nil {
return "", fmt.Errorf("writing buffer to hash :%w", err)
Expand All @@ -214,7 +214,7 @@ func computeBufferChecksum(buffer []byte) (string, error) {
}

func computeIndexChecksum(index *Index) (string, error) {
hash := sha256.New()
hash := crc32.NewIEEE()
if err := binary.Write(hash, binary.LittleEndian, index.Version); err != nil {
return "", fmt.Errorf("writing index version to hash: %w", err)
}
Expand Down

0 comments on commit c65f9e0

Please sign in to comment.