crewshin/ed25519swift
ed25199 implementation by pure swift
License
Ed25519 can be used, distributed and modified user the zlib license.
Requirements
Ed25519 requires Swift5.
macOS, iOS
Install
CocoaPods
pod 'ed25519swift'Swift Package Manager
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.2")
]Dependency
CryptoSwift for sha512
BigInt for reference implementation that is not included main Ed25519 library.
How to use
Key pair creation
import Ed25519macOS // direct
or
import ed25519swift // pods or Swift Package Manager
static func generateKeyPair() -> (publicKey: [UInt8], secretKey: [UInt8])Signing
static func sign(message: [UInt8], secretKey: [UInt8]) -> [UInt8]Validation
static func verify(signature: [UInt8], message: [UInt8], publicKey: [UInt8]) -> BoolCalc public key from secret key
static func calcPublicKey(secretKey: [UInt8]) -> [UInt8]Check valid keypair
static func isValidKeyPair(publicKey: [UInt8], secretKey: [UInt8]) -> BoolImplemantation
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
Performance
macOS
On MacBook Pro 2017 2.3Ghz Intel Core i5
message validation : 10.7 msec per message keypair creation : 4.8 msec per keypair
iOS
no measurement
Package Metadata
Repository: crewshin/ed25519swift
Stars: 0
Forks: 0
Open issues: 0
Default branch: master
Primary language: swift
License: Zlib
README: README.md
Fork: yes