aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/scalar.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/ec/scalar.py')
-rw-r--r--pyecsca/ec/scalar.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pyecsca/ec/scalar.py b/pyecsca/ec/scalar.py
index dc6101c..eba80cf 100644
--- a/pyecsca/ec/scalar.py
+++ b/pyecsca/ec/scalar.py
@@ -128,6 +128,13 @@ def naf(k: int) -> List[int]:
"""
Compute the NAF (Non-Adjacent Form) of the scalar `k`.
+ Properties ([GECC]_ 3.29):
+ a) k has a unique NAF denoted NAF(k).
+ b) NAF(k) has the fewest non-zero digits of any signed digit representation of k.
+ c) The length of NAF(k) is at most one more than the bit-length of k.
+ d) If the length of NAF(k) is l, then $2^l / 3 < k < 2^(l+1) / 3$.
+ e) The average density of non-zero digits among all NAFs of length l is approximately 1/3.
+
:param k: The scalar.
:return: The NAF.
"""