MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / BlindPrivateKey

Method BlindPrivateKey

libi2pd/Ed25519.cpp:485–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483 }
484
485 void Ed25519::BlindPrivateKey (const uint8_t * priv, const uint8_t * seed, uint8_t * blindedPriv, uint8_t * blindedPub)
486 {
487 BN_CTX * ctx = BN_CTX_new ();
488 // calculate alpha = seed mod l
489 BIGNUM * alpha = DecodeBN<64> (seed); // seed is in Little Endian
490 BN_mod (alpha, alpha, l, ctx); // % l
491 BIGNUM * p = DecodeBN<32> (priv); // priv is in Little Endian
492 BN_add (alpha, alpha, p); // alpha = alpha + priv
493 // a' = BLIND_PRIVKEY(a, alpha) = (a + alpha) mod L
494 BN_mod (alpha, alpha, l, ctx); // % l
495 EncodeBN (alpha, blindedPriv, 32);
496 // A' = DERIVE_PUBLIC(a')
497 auto A1 = MulB (blindedPriv, ctx);
498 EncodePublicKey (A1, blindedPub, ctx);
499 BN_free (alpha); BN_free (p);
500 BN_CTX_free (ctx);
501 }
502
503 void Ed25519::ExpandPrivateKey (const uint8_t * key, uint8_t * expandedKey)
504 {

Callers 2

BlindTestFunction · 0.45

Calls

no outgoing calls

Tested by 1

BlindTestFunction · 0.36