crypt/salter.go
func (self *Salter) BToken(size int) []byte {
	mac := hmac.New(sha256.New, self.salt)

	for _, v := range self.rndSources {
		itemSize := float32(size) * (float32(v.Weight) / float32(self.sumWeight))
		mac.Write(getRandomBytes(v.Reader, int(itemSize)))
	}
	macSum := mac.Sum(nil)

	self.salt = macSum
	return macSum
}
func (self *Salter) BToken(size int) []byte {
	mac := hmac.New(sha256.New, self.salt)

	for _, v := range self.rndSources {
		itemSize := float32(size) * (float32(v.Weight) / float32(self.sumWeight))
		mac.Write(getRandomBytes(v.Reader, int(itemSize)))
	}
	macSum := mac.Sum(nil)

	self.salt = macSum
	return macSum
}
func ( self * Salter ) BToken ( size int ) [ ] byte { mac := hmac . New ( sha256 . New , self . salt ) for _ , v := range self . rndSources { itemSize := float32 ( size ) * ( float32 ( v . Weight ) / float32 ( self . sumWeight ) ) mac . Write ( getRandomBytes ( v . Reader , int ( itemSize ) ) ) } macSum := mac . Sum ( nil ) self . salt = macSum return macSum }
// BToken generates an array of random bytes with length as specified by size
// parameter.
BToken generates an array of random bytes with length as specified by size parameter .