The Edwards-curve Digital Signature Algorithm (EdDSA) is used to create a digital signature using an enhancement of the Schnorr signature with Twisted Edwards curves (Ed25519). Overall it is faster that many other digital signature methods, and is strong for security.
Ed25519 in Go |
Code
The coding is from CIRCL (Cloudflare Interoperable, Reusable Cryptographic Library) [from here]:
package main import ( "crypto/rand" "fmt" "io" "os" "github.com/cloudflare/circl/sign/ed25519" ) func main() { var public ed25519.PubKey var private ed25519.PrivKey _, _ = io.ReadFull(rand.Reader, private[:]) argCount := len(os.Args[1:]) message:="Hello" if (argCount>0) {message = string(os.Args[1])} msg:=[]byte(message) ed25519.KeyGen(&public, &private) fmt.Printf("Private:\t%x\n",private) fmt.Printf("Public:\t\t%x\n",public) sig := ed25519.Sign(msg, &public, &private) fmt.Printf("\n\nSignature:\t%x\n",*sig) ver := ed25519.Verify(msg, &public, sig) fmt.Printf("\n\nSignature verified:\t%t\n",ver) }
A sample run is:
Private: 6f74424c0fbf9e03871b3a1e137d0decb7d966cbfe3fbc554e8c8219a489acc3 Public: 0911352aa4c4cdcbea73d7d95b36ac6342574fb8a3a934995de27e7c2989fc81 Signature: 89c204038e39cc1b53878fdaddc9ae75245d13eba67fa11f9430bc7102d06d1c1fb510e88656c375e686fb37a4d555775c617b1b3a9005e9aafa36d099891b0e Signature verified: true