Skip to content

Commit

Permalink
File changed to fixed padding (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode authored Nov 24, 2023
1 parent 3c3a2c9 commit 3d8226c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chain/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func cutfile(file string) ([]string, error) {
if i+1 != segmentCount {
return segment, errors.New("read file err")
}
copy(buf[num:], []byte(utils.RandStr(pattern.SegmentSize-num)))
copy(buf[num:], make([]byte, pattern.SegmentSize-num, pattern.SegmentSize-num))
}

hash, err := utils.CalcSHA256(buf)
Expand Down Expand Up @@ -227,7 +227,7 @@ func cutFileWithEncryption(file string) ([]string, error) {
if i+1 != segmentCount {
return segment, errors.New("read file err")
}
copy(buf[num:], []byte(utils.RandStr(segmentSize-num)))
copy(buf[num:], make([]byte, segmentSize-num, segmentSize-num))
}

hash, err := utils.CalcSHA256(buf)
Expand Down

0 comments on commit 3d8226c

Please sign in to comment.