mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 01:02:53 +02:00
flesh out comment for generateHeaderPadding
This commit is contained in:
19
sphinx.go
19
sphinx.go
@@ -179,15 +179,16 @@ func GenerateSphinxHeader(dest []byte, identifier [securityParameter]byte,
|
|||||||
return header, hopSharedSecrets, nil
|
return header, hopSharedSecrets, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateHeaderPadding...
|
// generateHeaderPadding derives the bytes for padding the mix header to ensure
|
||||||
// At each step, we add 2*securityParameter padding of zeroes, concatenate it
|
// it remains fixed sized throughout route transit. At each step, we add
|
||||||
// to the previous filler, then decrypt it (XOR) with the secret key of the
|
// 2*securityParameter padding of zeroes, concatenate it to the previous
|
||||||
// current hop. When encrypting the mix header we essentially do the reverse of
|
// filler, then decrypt it (XOR) with the secret key of the current hop. When
|
||||||
// this operation: we "encrypt" the padding, and drop 2*k number of zeroes. As
|
// encrypting the mix header we essentially do the reverse of this operation:
|
||||||
// nodes process the mix header they add the padding (2*k) and then decrypt
|
// we "encrypt" the padding, and drop 2*k number of zeroes. As nodes process
|
||||||
// eventually leaving only the original "filler" bytes produced by this function
|
// the mix header they add the padding (2*k) in order to check the MAC and
|
||||||
// at the last hop. Using this methodology, the size of the mix header stays
|
// decrypt the next routing information eventually leaving only the original
|
||||||
// constant at each hop.
|
// "filler" bytes produced by this function at the last hop. Using this
|
||||||
|
// methodology, the size of the mix header stays constant at each hop.
|
||||||
func generateHeaderPadding(numHops int, sharedSecrets [][sharedSecretSize]byte) []byte {
|
func generateHeaderPadding(numHops int, sharedSecrets [][sharedSecretSize]byte) []byte {
|
||||||
var filler []byte
|
var filler []byte
|
||||||
for i := 1; i < numHops; i++ {
|
for i := 1; i < numHops; i++ {
|
||||||
|
Reference in New Issue
Block a user