ecdh.bend checks
raw source on the hub · import element-crypto@0.1.0.0/ecdh.bend as Ecdh
5 imports
import Base import element-math@0.1.0.0/big.bend as Big import ./ecdsa.bend as Ec import ./ecp256.bend as E import ./sha256.bend as Sha256
Definitions
def order source · line 26 · raw
0x280fb10bca5c5d06ed8109bb4300bab8/big.Mod
n, the order of P-256's base point.
def times source · line 29 · raw
@+k:List<&2, U32> -> @+p:0x29d6f1ff259add9ea6c8f213fda12377/ecp256.Pt -> 0x29d6f1ff259add9ea6c8f213fda12377/ecp256.Pt
def scalar source · line 34 · raw
@+secret:List<&2, U32> -> List<&2, U32>
The scalar from 32 secret bytes: SHA-256 under a label (so it is not the x25519 key made from the same bytes), reduced into [1, n-1].
def public_key_of_scalar source · line 41 · raw
@+k:List<&2, U32> -> List<&2, U32>
04 || X || Y of k G, for a scalar k
def public_key source · line 44 · raw
@+secret:List<&2, U32> -> List<&2, U32>
def valid source · line 50 · raw
@+point:List<&2, U32> -> @+x:List<&2, U32> -> @+y:List<&2, U32> -> Bool
The peer's point must be uncompressed, in range and on the curve (an invalid point would leak the scalar, RFC 8422 5.11); the result must not be the point at infinity. X of k P, or None.
def scalar_of_bytes source · line 68 · raw
@+bs:List<&2, U32> -> List<&2, U32>
A scalar given as 32 big-endian bytes (test vectors name the scalar).