method ed25519.verify
True when signature is valid for message under publicKey (any malformed input is simply false).
Example:
use std.crypto { ed25519 }
use std.ser { bytesOf }
fn main() io, rand {
let kp = ed25519.generate()
let sig = ed25519.sign(&kp.secretKey, bytesOf(&"pay 10"))!
print("{ed25519.verify(kp.publicKey, bytesOf(&"pay 10"), sig)} {ed25519.verify(kp.publicKey, bytesOf(&"pay 99"), sig)}")
}Вывод
true false
pub(api) static fn verify(publicKey: bytes, message: bytes, signature: bytes) -> boolСложность. O(n) in the size of the message.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
publicKey | bytes |
message | bytes |
signature | bytes |
Возвращает
bool
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/crypto/crypto.oxl:661