Skip to content
FutureBlitz

    Install

    Import std.crypto.signatures

    Ed25519

    std.crypto.signatures

    struct

    Public Struct Ed25519

    Ed25519 (RFC 8032), EdDSA on Curve25519 with SHA-512: a private key is a 32-byte seed, a public key 32 bytes, and a signature 64 bytes, deterministic, so signing needs no random number.

    Examples

    Local privateKey = Ed25519.NewPrivateKey()
    Local publicKey = Ed25519.PublicKeyOf(privateKey)
    Local signature = Ed25519.Sign(privateKey, "release 1.0")
    Expect(Ed25519.Verify(publicKey, "release 1.0", signature))
    Expect(!Ed25519.Verify(publicKey, "release 1.1", signature))

    std/crypto/signatures.fb, line 44

    • Public Static Method NewPrivateKey(): UInt8[] static method #

      A new random private key.

    • @PanicsAtCaller Public Static Method PublicKeyOf(privateKey: UInt8[]): UInt8[] static method #

      privateKey's public key. Panics unless privateKey is 32 bytes.

    • @PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], message: UInt8[]): UInt8[] static method #

      message's signature with privateKey. Panics unless privateKey is 32 bytes.

    • @PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], text: String): UInt8[] static method #

      text's signature, by its UTF-8 bytes, with privateKey. Panics unless privateKey is 32 bytes.

    • Public Static Method Verify(publicKey: UInt8[], message: UInt8[], signature: UInt8[]): Bool static method #

      Whether signature is publicKey's of message.

    • Public Static Method Verify(publicKey: UInt8[], text: String, signature: UInt8[]): Bool static method #

      Whether signature is publicKey's of text's UTF-8 bytes.

    Report an issue with this page or with FutureBlitz on GitHub.