本文整理汇总了Golang中github.com/dedis/crypto/abstract.Point.PickLen方法的典型用法代码示例。如果您正苦于以下问题:Golang Point.PickLen方法的具体用法?Golang Point.PickLen怎么用?Golang Point.PickLen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/dedis/crypto/abstract.Point
的用法示例。
在下文中一共展示了Point.PickLen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ownerEncode
func (c *ownedCoder) ownerEncode(payload, payout []byte, p abstract.Point) {
// XXX trap-encode
// Pick a fresh random key with which to encrypt the payload
key := make([]byte, c.keylen)
c.random.XORKeyStream(key, key)
// Encrypt the payload with it
c.suite.Cipher(key).XORKeyStream(payout, payload)
// Compute a MAC over the encrypted payload
h := c.suite.Hash()
h.Write(payout)
mac := h.Sum(nil)[:c.maclen]
// Combine the key and the MAC into the Point for this cell header
hdr := append(key, mac...)
if len(hdr) != p.PickLen() {
panic("oops, length of key+mac turned out wrong")
}
mp, _ := c.suite.Point().Pick(hdr, c.random)
// Add this to the blinding point we already computed to transmit.
p.Add(p, mp)
}