Ed25519(EdDSA) by pure swift
Ed25519 can be used, distributed and modified user the zlib license.
Ed25519 requires Swift5.
macOS, iOS
pod 'ed25519swift'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding Ed25519 as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/pebble8888/ed25519swift.git", from: "1.2.7")
]
CryptoSwift for sha512
BigInt for reference implementation that is not included main Ed25519 library.
import Ed25519macOS // direct
or
import ed25519swift // pods or Swift Package Manager
static func Ed25519.generateKeyPair() -> (publicKey: [UInt8], secretKey: [UInt8])
static func Ed25519.sign(message: [UInt8], secretKey: [UInt8]) -> [UInt8]
static func Ed25519.verify(signature: [UInt8], message: [UInt8], publicKey: [UInt8]) -> Bool
static func Ed25519.calcPublicKey(secretKey: [UInt8]) -> [UInt8]
static func Ed25519.isValidKeyPair(publicKey: [UInt8], secretKey: [UInt8]) -> Bool
It is ported from SUPERCOP
You can check the algorithm in these papers and RFC.
Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe, and Bo-Yin Yang, High-speed high-security signatures. 2012
Huseyin Hisl, Kenneth Koon-Ho Wong, Gary Carter, Ed Dawson, Twisted Edwards curves revisited. 2008
RFC8032 Edward-Curve Digital Signature Algorithm (EdDSA)
On MacBook Pro 2017 2.3Ghz Intel Core i5
message validation : 10.7 msec per message
keypair creation : 4.8 msec per keypair
no measurement