Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

debuggor/schnorrkel-java

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
17 Commits
 
 
 
 
 
 

Repository files navigation

schnorrkel-java

Java implementation of the sr25519 signature algorithm (schnorr over ristretto25519). The existing rust implementation is here.

This library is currently able to create sr25519 keys, import sr25519 keys, and sign and verify messages.

usage

Example: signing and verification

import com.debuggor.schnorrkel.utils.HexUtils;

public class SignTest {

    public static void main(String[] args) throws Exception {
        KeyPair keyPair = KeyPair.fromSecretSeed(HexUtils.hexToBytes("579d7aa286b37b800b95fe41adabbf0c2a577caf2854baeca98f8fb242ff43ae"), ExpansionMode.Ed25519);

        byte[] message = "test message".getBytes();
        SigningContext ctx = SigningContext.createSigningContext("good".getBytes());
        SigningTranscript t = ctx.bytes(message);
        Signature signature = keyPair.sign(t);
        byte[] sign = signature.to_bytes();
        System.out.println(HexUtils.bytesToHex(sign));


        SigningContext ctx2 = SigningContext.createSigningContext("good".getBytes());
        SigningTranscript t2 = ctx2.bytes(message);
        KeyPair fromPublicKey = KeyPair.fromPublicKey(keyPair.getPublicKey().toPublicKey());
        boolean verify = fromPublicKey.verify(t2, sign);
        System.out.println(verify);
    }
}

other

Go implementation

Thanks to @str4d and @isislovecruft for the open source Curve25519 library

About

schnorr signature on the Ristretto group

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.