Skip to content

Commit a46deb2

Browse files
Use non-reduced scalar bytes input length for scalar_reduce()
1 parent 91998b3 commit a46deb2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/rbcl/rbcl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def crypto_core_ristretto255_scalar_reduce(s: bytes) -> bytes:
365365
In the example below, a large integer representing a scalar is reduced to
366366
a valid scalar:
367367
368-
>>> x = bytes.fromhex('FF' * 32)
368+
>>> x = bytes.fromhex('FF' * 64)
369369
>>> s = crypto_core_ristretto255_scalar_reduce(x)
370370
>>> p = crypto_core_ristretto255_random()
371371
>>> masked = crypto_scalarmult_ristretto255(s, p)
@@ -382,23 +382,23 @@ def crypto_core_ristretto255_scalar_reduce(s: bytes) -> bytes:
382382
... except TypeError as e:
383383
... str(e) == (
384384
... 'scalar must be a bytes object of length ' +
385-
... str(crypto_core_ristretto255_SCALARBYTES)
385+
... str(crypto_core_ristretto255_NONREDUCEDSCALARBYTES)
386386
... )
387387
True
388388
>>> try:
389389
... crypto_core_ristretto255_scalar_reduce(bytes([0, 0 ,0]))
390390
... except ValueError as e:
391391
... str(e) == (
392392
... 'scalar must be a bytes object of length ' +
393-
... str(crypto_core_ristretto255_SCALARBYTES)
393+
... str(crypto_core_ristretto255_NONREDUCEDSCALARBYTES)
394394
... )
395395
True
396396
"""
397397
well_typed = isinstance(s, bytes)
398-
if not well_typed or len(s) != crypto_core_ristretto255_SCALARBYTES:
398+
if not well_typed or len(s) != crypto_core_ristretto255_NONREDUCEDSCALARBYTES:
399399
raise (ValueError if well_typed else TypeError)(
400400
'scalar must be a bytes object of length ' +
401-
str(crypto_core_ristretto255_SCALARBYTES)
401+
str(crypto_core_ristretto255_NONREDUCEDSCALARBYTES)
402402
)
403403

404404
r = _crypto_core_ristretto255_scalar_new()
@@ -622,7 +622,7 @@ def crypto_scalarmult_ristretto255_base(s: bytes) -> bytes:
622622
"""
623623
Compute and return the product (represented as a byte vector of length
624624
:obj:`crypto_scalarmult_ristretto255_BYTES`) of a standard group element
625-
and a scalar ``s``.
625+
and a scalar ``s``.
626626
627627
:param s: Byte vector of length :obj:`crypto_scalarmult_ristretto255_SCALARBYTES`
628628
representing a scalar.

0 commit comments

Comments
 (0)