Import std.crypto.signatures
Ed25519
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
-
A new random private key.
-
privateKey's public key. Panics unlessprivateKeyis 32 bytes. -
@PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], message: UInt8[]): UInt8[]static method #message's signature withprivateKey. Panics unlessprivateKeyis 32 bytes. -
@PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], text: String): UInt8[]static method #text's signature, by its UTF-8 bytes, withprivateKey. Panics unlessprivateKeyis 32 bytes. -
Public Static Method Verify(publicKey: UInt8[], message: UInt8[], signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's ofmessage. -
Public Static Method Verify(publicKey: UInt8[], text: String, signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's oftext's UTF-8 bytes.
Report an issue with this page or with FutureBlitz on GitHub.