コード例 #1
0
ファイル: skein256.go プロジェクト: enceve/crypto
func (s *hashFunc) update(block *[4]uint64) {
	threefish.IncrementTweak(&(s.tweak), threefish.BlockSize256)

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

	s.tweak[1] &^= skein.FirstBlock
}
コード例 #2
0
ファイル: skein256.go プロジェクト: enceve/crypto
func (s *hashFunc) output(dst *[threefish.BlockSize256]byte, counter uint64) {
	var block [4]uint64
	block[0] = counter

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

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

	blockToBytes(dst[:], &block)
}
コード例 #3
0
ファイル: skein256.go プロジェクト: enceve/crypto
func (s *hashFunc) finalizeHash() {
	threefish.IncrementTweak(&(s.tweak), uint64(s.off))
	s.tweak[1] |= skein.FinalBlock // set the last block flag

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

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

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