mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
crypto, math: change option to result (#17580)
This commit is contained in:
parent
32d09544d7
commit
b42a3f43a5
@ -33,7 +33,7 @@ fn (mut s Scalar) pow2k(k int) {
|
|||||||
// If the coordinates are invalid or don't represent a valid point on the curve,
|
// If the coordinates are invalid or don't represent a valid point on the curve,
|
||||||
// set_extended_coordinates returns an error and the receiver is
|
// set_extended_coordinates returns an error and the receiver is
|
||||||
// unchanged. Otherwise, set_extended_coordinates returns v.
|
// unchanged. Otherwise, set_extended_coordinates returns v.
|
||||||
fn (mut v Point) set_extended_coordinates(x Element, y Element, z Element, t Element) ?Point {
|
fn (mut v Point) set_extended_coordinates(x Element, y Element, z Element, t Element) !Point {
|
||||||
if !is_on_curve(x, y, z, t) {
|
if !is_on_curve(x, y, z, t) {
|
||||||
return error('edwards25519: invalid point coordinates')
|
return error('edwards25519: invalid point coordinates')
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ pub fn uint128_new(lo u64, hi u64) Uint128 {
|
|||||||
return Uint128{lo, hi}
|
return Uint128{lo, hi}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uint128_from_dec_str(value string) ?Uint128 {
|
pub fn uint128_from_dec_str(value string) !Uint128 {
|
||||||
mut res := unsigned.uint128_zero
|
mut res := unsigned.uint128_zero
|
||||||
for b_ in value.bytes() {
|
for b_ in value.bytes() {
|
||||||
b := b_ - '0'.bytes()[0]
|
b := b_ - '0'.bytes()[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user