Skip to content

Digital signature algorithm based on elliptic curve cryptography

License

Notifications You must be signed in to change notification settings

nirvana369/ed25519

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ed25519

Motoko implementation of ed25519.

This library is a porting version of noble-ed25519.

Dependencies :

Usage

Vessel are supported:

Setting of dfx.json :

{
    "defaults": {
      "build": {
        "packtool": "vessel sources"
      }
    },
    "version": 1
}

Setting of package-set.dhall :

let additions = [
       { name = "ed25519"
        , version = "v1.0.0"
        , repo = "https://github.com/nirvana369/ed25519.git"
        , dependencies = [ "base" ] : List Text
        }
    ]

How to use :

import Lib "mo:ed25519";

let privateKey = Lib.Utils.randomPrivateKey();
let message : [Nat8] = [0xab, 0xbc, 0xcd, 0xde];
let publicKey = Lib.ED25519.getPublicKey(privateKey);
let signature = Lib.ED25519.sign(message, privateKey);
let isValid = Lib.ED25519.verify(signature, message, publicKey);

Security Considerations

The randomPrivateKey() function is designed based on a simple algorithm using the fuzz library to generate random bytes, which does not provide strong cryptographic randomness. Please use an external library if you have high security requirements.

Demo

(https://github.com/nirvana369/ed25519-demo).

License

MIT (c) nirvana369.

About

Digital signature algorithm based on elliptic curve cryptography

Resources

License

Stars

Watchers

Forks

Packages

No packages published