As part of a learning more about deep learning, I have been experimenting with writing ResNets with Dense layers to do different types of regression.

I was interested in trying a harder problem and have been working on a network that, given a private key, could perform point multiplication along ECC curve to obtain a public key.

I have tried training on a dataset of generated keypairs, but am seeing the test loss values bounce around like crazy with train loss values eventually decreasing after many epochs due to what I assume is overfitting.

Is this public key generation problem even solvable with a deep learning architecture? If so, am I doing something wrong with my current approach?

  • $\begingroup$ Can you explain further what you mean by ResNets with Dense layers? What are the hidden sizes, # of layers, activation function, etc? $\endgroup$ Dec 21 '20 at 21:36
  • $\begingroup$ Also, to clarify, the network was able to predict the training instances correctly right? Only the test instances have poor accuracy? What is the training accuracy? $\endgroup$ Dec 21 '20 at 22:03
  • $\begingroup$ @user3667125 28 blocks of layers. Layers are 32 wide, and there is a skip connection every 2 layers. ReLU activation function. I am dealing with 256 byte input and 264 byte output, so I just pass these in as byte arrays. $\endgroup$
    – superuser
    Dec 24 '20 at 0:43
  • $\begingroup$ @user3667125 The problem is that currently the model just gives a value near 128 for every byte, since loss function is MSE. $\endgroup$
    – superuser
    Dec 24 '20 at 0:44
  • 1
    $\begingroup$ @user3667125 Ok, thanks for the ideas. I actually was thinking the same things haha. I 've been working on a simpler point addition network and was also playing around with modulus operations and actually just writing a simple network to compute x raised to a constant and mod some other constant. Will keep you updated! If you want to post an answer I'll give you the bounty. $\endgroup$
    – superuser
    Dec 25 '20 at 19:20

I don't know of any neural network that can do cryptography well, so you would have to do a little experimenting yourself. The main thing that sticks out to me is that doing operations in the elliptical curve requires the modulus operator since it works in finite field, and I think neural networks have a hard time learning the modulus operator in general. So I would focus on that first. Some things to help the network learn the modulus operator:

  • I would try to increase the hidden layers to a number 4x-10x bigger than the input dimension, which maps it to a higher dimension to hopefully learn more complex behavior.
  • I would use less layers, maybe only 2-4 hidden layers, to speed up the development time.
  • Most importantly, I would train with a LOT of data points (25% of the total possible finite field possibilities). I don't think the neural network can learn unless the number of data is this high.
  • For reference, someone got a network to learn the modulus operator using these points.

For rapid iterating, I would test with a much smaller finite field. E.g. use a 8 bit security and see if the neural network can do well with that first before moving on to the full 256-bit security key (or whatever your end goal is).

Taking this a step further, I would first test to see if the neural network can even perform a point addition in the elliptical curve well, because if it doesn't then it definitely can't do point multiplication which is needed to compute the public key.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.