MCPcopy
hub / github.com/grpc/grpc-go / maskNonce

Function maskNonce

credentials/alts/internal/conn/aeadrekey.go:105–112  ·  view source on GitHub ↗

maskNonce XORs the given nonce with the mask and stores the result in dst.

(dst, nonce, mask []byte)

Source from the content-addressed store, hash-verified

103
104// maskNonce XORs the given nonce with the mask and stores the result in dst.
105func maskNonce(dst, nonce, mask []byte) {
106 nonce1 := binary.LittleEndian.Uint64(nonce[:sizeUint64])
107 nonce2 := binary.LittleEndian.Uint32(nonce[sizeUint64:])
108 mask1 := binary.LittleEndian.Uint64(mask[:sizeUint64])
109 mask2 := binary.LittleEndian.Uint32(mask[sizeUint64:])
110 binary.LittleEndian.PutUint64(dst[:sizeUint64], nonce1^mask1)
111 binary.LittleEndian.PutUint32(dst[sizeUint64:], nonce2^mask2)
112}
113
114// NonceSize returns the required nonce size.
115func (s *rekeyAEAD) NonceSize() int {

Callers 2

SealMethod · 0.85
OpenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected