Skip to content

Warchant/ed25519-sha3-java

 
 

Repository files navigation

EdDSA-Java

Build Status Codacy Badge FOSSA Status

This is an implementation of EdDSA (SHA3) in Java. Structurally, it is based on the ref10 implementation in SUPERCOP (see https://ed25519.cr.yp.to/software.html).

There are two internal implementations:

  • A port of the radix-2^51 operations in ref10 - fast and constant-time, but only useful for Ed25519.
  • A generic version using BigIntegers for calculation - a bit slower and not constant-time, but compatible with any EdDSA parameter specification.

To use

Gradle users:

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.github.warchant:ed25519-sha3-java:1.0'

The code requires Java 6 (for e.g. the Arrays.copyOfRange() calls in EdDSAEngine.engineVerify()).

The JUnit4 tests require the Hamcrest library hamcrest-all.jar.

This code is released to the public domain and can be used for any purpose. See LICENSE.txt for details.

Usage Example

Security.addProvider(new EdDSASecurityProvider());

KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EdDSA/SHA3", "EdDSA");
KeyFactory keyFac = KeyFactory.getInstance("EdDSA/SHA3", "EdDSA");
Signature sgr = Signature.getInstance("EdDSA/SHA3", "EdDSA");

Disclaimer

There are no guarantees that this is secure for all cases, and users should review the code themselves before depending on it. PRs that fix bugs or improve reviewability are very welcome. Additionally:

License

FOSSA Status