Skip to content

Hello friend! We both wrote Pure Swift ECC SDKs this summerΒ #1

@Sajjon

Description

@Sajjon

We seem to have been working on the same thing :D

Have a look at EllipticCurveKit. My goal is to finish my rewrite using EquationKit, I have got it working already in the equations branch which allows for pretty cool syntax:

///
/// Elliptic Curve on Short Weierstrass form (`𝑆`)
/// - Covers all elliptic curves charβ‰ πŸš,πŸ›
/// - Mixed Jacobian coordinates have been the speed leader for a long time.
///
///
/// # Equation
///      𝑆: 𝑦² = π‘₯Β³ + π‘Žπ‘₯ + 𝑏
/// - Requires: `πŸœπ‘ŽΒ³ + πŸšπŸŸπ‘Β² β‰  𝟘`
///
public struct ShortWeierstraßCurve: CurveForm {


    private let a: Number
    private let b: Number
    public let galoisField: Field
    public let equation: Polynomial

    private let π‘₯οΌ‡: Polynomial
    private let 𝑦': Polynomial

    public init?(
        a: Number,
        b: Number,
        galoisField: Field
        ) {

        let 𝑝 = galoisField.modulus

        guard πŸœπ‘ŽΒ³ + πŸšπŸŸπ‘Β² β‰’ 𝟘 % 𝑝 ↀ [ π‘Ž ≔ a, 𝑏 ≔ b ] else { return nil }

        self.a = a
        self.b = b
        self.galoisField = galoisField
        self.equation = EllipticCurveForm.Weierstraß.short.substitute() {[ π‘Ž ≔ a, 𝑏 ≔ b ] }
        self.π‘₯οΌ‡ = equation.differentiateWithRespectTo(π‘₯)!
        self.𝑦' = equation.differentiateWithRespectTo(𝑦)!
    }
}

I have also begun implemented other curve forms than ShortWeierstraß, such as TwistedEdwards and Montgomery.

I saw you PR in CryptoSwift adding support for Scrypt which I am also working on currently.

I'm in need of it in the Zilliqa Swift SDK I am developing, for the export wallet function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions