mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-09 20:49:08 +02:00
adds comments to the lioness block cipher implementation
This commit is contained in:
parent
98b228d77e
commit
cbfefdf0f4
11
lionness.go
11
lionness.go
@ -5,9 +5,11 @@ import (
|
||||
"crypto/sha256"
|
||||
)
|
||||
|
||||
// lionEncode...
|
||||
// block cipher with a block size equivalent to our message size
|
||||
// http://www.cl.cam.ac.uk/~rja14/Papers/bear-lion.pdf (section 6)
|
||||
// lionEncode encrypts a message of fixed size using the LIONESS block cipher.
|
||||
// The LIONESS block cipher is unique due to its variable block size. Within our
|
||||
// application we set the block size equivalent to our fixed message size.
|
||||
// Details concerning the rationale, security model and internals of the
|
||||
// LIONESS block cipher can be found here: http://www.cl.cam.ac.uk/~rja14/Papers/bear-lion.pdf (section 6)
|
||||
func lionessEncode(key [securityParameter]byte, message [messageSize]byte) [messageSize]byte {
|
||||
var cipherText [messageSize]byte
|
||||
copy(cipherText[:], message[:])
|
||||
@ -42,7 +44,8 @@ func lionessEncode(key [securityParameter]byte, message [messageSize]byte) [mess
|
||||
return cipherText
|
||||
}
|
||||
|
||||
// lionDecode...
|
||||
// lionDecode performs the inverse operation of lionessEncode. Namely,
|
||||
// decrypting a previously generated cipher text, returning the original plaintext.
|
||||
func lionessDecode(key [securityParameter]byte, cipherText [messageSize]byte) [messageSize]byte {
|
||||
var message [messageSize]byte
|
||||
copy(message[:], cipherText[:])
|
||||
|
Loading…
x
Reference in New Issue
Block a user