Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ElligatorSwift #107

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Implement ElligatorSwift #107

wants to merge 2 commits into from

Conversation

paulmillr
Copy link
Owner

@paulmillr paulmillr commented Jan 14, 2024

ElligatorSwift: Schnorr-like x-only ECDH with public keys indistinguishable
from uniformly random bytes.
https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki,
https://github.com/bitcoin/bitcoin/blob/master/src/secp256k1/doc/ellswift.md
SwiftEC: Shallue-van de Woestijne Indifferentiable Function to Elliptic Curves.
https://eprint.iacr.org/2022/759.pdf

Curve25519 & P-521 are incompatible with SwiftEC. Differences from SwiftEC:

  • undefined inputs are remapped
  • y-parity is encoded in u/t values

TODO: understand if these methods have proper names and types.

encode: (x: bigint | PointType<bigint>) => Uint8Array;
decode: (data: Hex) => Uint8Array;
keygen: () => { privateKey: Uint8Array; publicKey: Uint8Array; };
getSharedSecret: (privateKeyA: Hex, publicKeyB: Hex) => Uint8Array;
getSharedSecretBip324: (privateKeyOurs: Hex, publicKeyTheirs: Hex, publicKeyOurs: Hex, initiating: boolean) => Uint8Array;

Closes gh-8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement elligatorswift
1 participant