From b1dfeb3724552a0b72c5aec3979ebe4e3e7f5381 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 14 Oct 2015 23:42:10 -0700 Subject: [PATCH] switch default securityParamter to 32 bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Node ID’s can only be as long as the security parameter k. Using 16 gives us much smaller overhead for routing messages. However, this means all node ID’s would have to be 16 bytes. * So with this change a node-id is the SHA-256 of a node’s public key. The public key MUST be serialized in compressed form. This node-id could then possibly be encoded as a bitcoin address (Base58Check). * It’s assumed senders have a way to retrieve a node’s public key given the node id. --- sphinx.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sphinx.go b/sphinx.go index 2d2a654b1..0a39aa174 100644 --- a/sphinx.go +++ b/sphinx.go @@ -12,25 +12,26 @@ import ( ) const ( - // So, 256-bit EC curve, 128-bit keys symmetric encryption, 128-bit keys for - // HMAC, etc. Stored in bytes, here. - securityParameter = 16 + // So, 256-bit EC curve pubkeys, 256-bit keys symmetric encryption, + // 256-bit keys for HMAC, etc. Represented in bytes. + securityParameter = 32 - // Default message size in bytes. This is probably too big atm? + // Default message size in bytes. This is probably *much* too big atm? messageSize = 1024 // Mix header over head. If we assume 5 hops (which seems sufficient for // LN, for now atleast), 32 byte group element to be re-randomized each - // hop, and 16 byte symmetric key. + // hop, and 32 byte symmetric key. // Overhead is: p + (2r + 2)s // * p = pub key size (in bytes, for DH each hop) // * r = max number of hops // * s = summetric key size (in bytes) - // It's: 32 + (2*5 + 2) * 16 = 224 bytes! But if we use secp256k1 instead of + // It's: 32 + (2*5 + 2) * 32 = 416 bytes! But if we use secp256k1 instead of // Curve25519, then we've have an extra byte for the compressed keys. - mixHeaderOverhead = 225 + mixHeaderOverhead = 417 - // Basically an upper limit on the diameter on our node graph. + // The maximum path length. This should be set to an + // estiamate of the upper limit of the diameter of the node graph. numMaxHops = 5 // Special destination to indicate we're at the end of the path.