swarm/network: Clarify comment about privatekey generation data

This commit is contained in:
lash 2019-03-22 13:32:31 +01:00
parent d2ad11c940
commit b2540215b5

View file

@ -329,9 +329,9 @@ func init() {
}
// derive a private key for swarm for the node key
// returns the private key used to generate the bzz key AND the generated bzz key
// returns the private key used to generate the bzz key
func BzzKeyFromConfig(conf *adapters.NodeConfig) (*ecdsa.PrivateKey, error) {
// ecdsa.GenerateKey takes 40 bytes entropy
// pad the seed key some arbitrary data as ecdsa.GenerateKey takes 40 bytes seed data
privKeyBuf := append(crypto.FromECDSA(conf.PrivateKey), []byte{0x62, 0x7a, 0x7a, 0x62, 0x7a, 0x7a, 0x62, 0x7a}...)
bzzPrivateKey, err := ecdsa.GenerateKey(crypto.S256(), bytes.NewReader(privKeyBuf))
if err != nil {