Example #1
0
func (tsd *Digest) Reset() {
	tsd.headerBuffer.Reset()
	tsd.currentBuffer.Reset()

	tsd.digestStage = stageReadHeader
	tsd.tarReader = new(tar.Reader)
	tsd.entryHash = sha256.New()
	tsd.sums = fileInfoSums{}
	tsd.fileCounter = 0
	tsd.bytesWritten = 0
	tsd.currentFilename = ""
	tsd.pad = 0
	tsd.err = nil
}
Example #2
0
func (tsd *Digest) Sum(extra []byte) []byte {
	tsd.sums.SortBySums()
	hasher := sha256.New()

	if extra != nil {
		hasher.Write(extra)
	}

	for _, fis := range tsd.sums {
		hasher.Write([]byte(fis.Sum()))
	}

	return hasher.Sum(nil)
}
Example #3
0
func (tsd *Digest) BlockSize() int {
	return sha256.New().BlockSize()
}
Example #4
0
func (tsd *Digest) Size() int {
	return sha256.New().Size()
}