ed448

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

README

github.com/lestrrat-go/dsig-circl-ed448 Go Reference

Ed448 signing/verification support for github.com/lestrrat-go/dsig, powered by cloudflare/circl.

Why a separate module?

Go's standard library does not include Ed448 support. The only viable implementation comes from github.com/cloudflare/circl, which is a large dependency. Rather than forcing every dsig user to pull in circl, Ed448 support is provided as an opt-in companion module.

Synopsis

Import this package for its side effects to register Ed448 with dsig:

package ed448_test

import (
  "fmt"

  "github.com/cloudflare/circl/sign/ed448"
  "github.com/lestrrat-go/dsig"

  _ "github.com/lestrrat-go/dsig-circl-ed448"
)

func Example() {
  // Generate an Ed448 key pair
  pub, priv, err := ed448.GenerateKey(nil)
  if err != nil {
    fmt.Printf("failed to generate key: %s\n", err)
    return
  }

  payload := []byte("Hello, Ed448!")

  // Sign with Ed448 private key
  signature, err := dsig.Sign(priv, "Ed448", payload, nil)
  if err != nil {
    fmt.Printf("failed to sign: %s\n", err)
    return
  }

  // Verify with Ed448 public key
  if err := dsig.Verify(pub, "Ed448", payload, signature); err != nil {
    fmt.Printf("failed to verify: %s\n", err)
    return
  }
  fmt.Println("signature verified")

  // Output:
  // signature verified
}

source: example_test.go

Installation

go get github.com/lestrrat-go/dsig-circl-ed448

Documentation

Overview

Package ed448 provides Ed448 signing and verification support for the dsig library.

Ed448 is not included in the main dsig module because Go's standard library does not support Ed448, requiring the external github.com/cloudflare/circl module. To avoid adding this dependency for all users, Ed448 support is provided as a separate module.

To enable Ed448 support, import this package for its side effects:

import _ "github.com/lestrrat-go/dsig-circl-ed448"

This registers an "Ed448" algorithm with dsig. After importing, dsig.Sign and dsig.Verify can be used with the "Ed448" algorithm name.

Example
package main

import (
	"fmt"

	"github.com/cloudflare/circl/sign/ed448"
	"github.com/lestrrat-go/dsig"

	_ "github.com/lestrrat-go/dsig-circl-ed448"
)

func main() {
	// Generate an Ed448 key pair
	pub, priv, err := ed448.GenerateKey(nil)
	if err != nil {
		fmt.Printf("failed to generate key: %s\n", err)
		return
	}

	payload := []byte("Hello, Ed448!")

	// Sign with Ed448 private key
	signature, err := dsig.Sign(priv, "Ed448", payload, nil)
	if err != nil {
		fmt.Printf("failed to sign: %s\n", err)
		return
	}

	// Verify with Ed448 public key
	if err := dsig.Verify(pub, "Ed448", payload, signature); err != nil {
		fmt.Printf("failed to verify: %s\n", err)
		return
	}
	fmt.Println("signature verified")

}
Output:
signature verified

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL