本文整理匯總了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)
}