Ed25519 by pure swift
Ed25519 can be used, distributed and modified user the zlib license.
Ed25519 requires Swift 4.
macOS, iOS
pod 'ed25519swift'
CryptoSwift for sha512
BigInt for reference implementation that is not included main Ed25519 library.
import Ed25519macOS // direct
or
import ed25519swift // pods
static func crypto_sign_keypair() -> (pk:[UInt8], sk:[UInt8])
static func crypto_sign(_ sm:inout [UInt8], _ m:[UInt8], _ skpk:[UInt8])
static func crypto_sign_open(_ sm:[UInt8], _ pk:[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 message
no measurement