kj3104 / ed25519swift

ed25199 + Sha3 implementation by pure swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ed25519

Ed25519(SHA3) by pure swift

ed25519

License

Ed25519 can be used, distributed and modified user the zlib license.

Requirements

Ed25519 requires Swift 4.

macOS, iOS

Install

CocoaPods

pod 'ed25519swift', :git => 'https://github.com/luca3104/ed25519swift.git'

Dependency

CryptoSwift for sha3-512

BigInt for reference implementation that is not included main Ed25519 library.

How to use

Key pair creation

import Ed25519macOS // direct
or
import ed25519swift // pods

static func generate_keypair() -> (pub:String, pri:String)

Signing

static func sign(_ msg:String, _ pri:String, _ pub:String)) -> String

Validation

static func verify(_ sig:String, _ msg:String, _ pub:String) -> Bool

Implemantation

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)

Performance

macOS

On MacBook Pro 2017 2.3Ghz Intel Core i5 11 sec for 1024 message validation 10 msec for a message validation  

iOS

no measurement

About

ed25199 + Sha3 implementation by pure swift

License:zlib License


Languages

Language:Swift 53.8%Language:C 42.4%Language:C++ 2.4%Language:Python 0.9%Language:Objective-C 0.4%Language:Ruby 0.2%