示例#1
0
文件: skein512.go 项目: enceve/crypto
func (s *hashFunc) update(block *[8]uint64) {
	threefish.IncrementTweak(&(s.tweak), BlockSize)

	threefish.UBI512(block, &(s.hVal), &(s.tweak))

	s.tweak[1] &^= FirstBlock
}
示例#2
0
文件: skein512.go 项目: enceve/crypto
func (s *hashFunc) output(dst *[BlockSize]byte, counter uint64) {
	var block [8]uint64
	block[0] = counter

	hVal := s.hVal
	var outTweak = [3]uint64{8, CfgOutput<<56 | FirstBlock | FinalBlock, 0}

	threefish.UBI512(&block, &hVal, &outTweak)
	block[0] ^= counter

	blockToBytes(dst[:], &block)
}
示例#3
0
文件: skein512.go 项目: enceve/crypto
func (s *hashFunc) finalizeHash() {
	threefish.IncrementTweak(&(s.tweak), uint64(s.off))
	s.tweak[1] |= FinalBlock

	for i := s.off; i < len(s.block); i++ {
		s.block[i] = 0
	}
	s.off = 0

	var block [8]uint64
	bytesToBlock(&block, s.block[:])

	threefish.UBI512(&block, &(s.hVal), &(s.tweak))
}