mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
crypto: add sub function to Ristretto255 (#23724)
This commit is contained in:
parent
7401f06f99
commit
369177f0ba
1 changed files with 6 additions and 1 deletions
|
|
@ -150,11 +150,16 @@ pub const Ristretto255 = struct {
|
|||
return .{ .p = p.p.add(q.p) };
|
||||
}
|
||||
|
||||
/// Subtract two Ristretto255 elements.
|
||||
pub inline fn sub(p: Ristretto255, q: Ristretto255) Ristretto255 {
|
||||
return .{ .p = p.p.sub(q.p) };
|
||||
}
|
||||
|
||||
/// Multiply a Ristretto255 element with a scalar.
|
||||
/// Return error.WeakPublicKey if the resulting element is
|
||||
/// the identity element.
|
||||
pub inline fn mul(p: Ristretto255, s: [encoded_length]u8) (IdentityElementError || WeakPublicKeyError)!Ristretto255 {
|
||||
return Ristretto255{ .p = try p.p.mul(s) };
|
||||
return .{ .p = try p.p.mul(s) };
|
||||
}
|
||||
|
||||
/// Return true if two Ristretto255 elements are equivalent
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue