3

This is how to get the curve25519 basepoint in monero (use js console at https://xmr.llcoins.net/)

> var identity = "0100000000000000000000000000000000000000000000000000000000000000"
> var base = ge_scalarmult_base(identity)
> base
"5866666666666666666666666666666666666666666666666666666666666666"

The C++ implementation gives the same string (using rct::scalarmultBase(rct::identity())).

In java, there's a standard crypto library called bouncycastle (maven: org.bouncycastle:bcprov-debug-jdk15on:1.59). The java code in the research lab uses bouncycastle: https://github.com/monero-project/research-lab.git

This is how to print the basepoint using bouncycastle:

ECParameterSpec curve = ECNamedCurveTable.getParameterSpec("curve25519");
ECPoint base = curve.getG();
byte[] bytes = base.getEncoded(true);
for (int i = 0; i < bytes.length; i++) {
  System.out.format("%02x", bytes[i]);
}
// 032aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad245a

So the basepoint looks a bit different this time. Apparently these are different ways to encode the same curve point. Is there a way to convert one form to the other?

  • Apparently monero doesn't use curve25519 exactly, but a variant called Ed25519. Maybe libsodium is more appropriate than bouncycastle. – Lustiger Astronaut Mar 3 '18 at 6:15
3

Monero uses ed25519. The code in the github link you referenced (which I helped write) uses curve25519 instead of ed25519. The reason is that that code was to prototype RTRS RingCT, which relies heavily on variable base scalar multiplication. Curve25519 is higher performance at variable base scalar multiplication than ed25519.

Prior to switching that project to curve25519, I'd already written code that uses an ed25519 library in Java, where the ed25519 library was borrowed from the NEM project. You can see the old commit of the ed25519 Java code here: https://github.com/monero-project/research-lab/commit/46d95551ff1852aa2e13a875b25d817a7f044a1c#diff-4c2f0ce20e9eb6549240e4f58175980a

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.