crypto/ec_encryption
library
Properties
-
G
→ ECPoint
-
Group order 'n'
final
-
n
→ BigInt
-
Extract the elliptic curve's group order 'n' and generator point 'G'.
final
-
secp256k1
→ ECCurve_secp256k1
-
Create an instance of the secp256k1 elliptic curve.
final
Functions
-
generateTweek(Uint8List point, Uint8List tweak)
→ Uint8List?
-
This function generates a tweaked private key from a private key and a tweak.
It performs validation checks and returns the tweaked private key as a Uint8List.
If the inputs are invalid or the resulting tweaked private key is invalid, it returns null.
-
isOrderScalar(dynamic x)
→ bool
-
This function checks if a value 'x' is a valid scalar less than the elliptic curve group order.
It first ensures that 'x' is a scalar and then compares it to the group order.
It returns true if 'x' is a valid scalar less than the group order; otherwise, it returns false.
-
isPoint(Uint8List p)
→ bool
-
This function checks if a Uint8List 'p' represents a valid elliptic curve point.
It performs several checks on the structure and values within 'p' to determine validity.
It returns true if 'p' is a valid point; otherwise, it returns false.
-
isPrivate(Uint8List x)
→ bool
-
Generator point 'G'
This function checks if a Uint8List 'x' represents a valid private key.
It performs multiple checks to ensure 'x' is a valid scalar within a specified range.
It returns true if 'x' is a valid private key; otherwise, it returns false.
-
isScalar(Uint8List x)
→ bool
-
This function checks whether a Uint8List represents a scalar value.
In many cryptographic contexts, scalar values are expected to be 32 bytes long.
It returns true if the input Uint8List has a length of 32 bytes, indicating it's a scalar; otherwise, it returns false.
-
pointAddScalar(Uint8List p, Uint8List tweak, bool compress)
→ Uint8List?
-
This method performs point addition with a scalar value and optional compression.
It takes a point 'p', a tweak 'tweak', and a boolean 'compress' flag as input.
If the inputs are valid, it returns the result of the point addition as a Uint8List.
If any input is invalid or if the result is infinity, it returns null.
-
pointFromScalar(Uint8List d, bool compress)
→ Uint8List?
-
-
reEncodedFromForm(Uint8List p, bool compressed)
→ Uint8List
-
This function re-encodes a given Uint8List point representation based on a compression flag.
If 'compressed' is true, it ensures that the point representation is compressed.
If 'compressed' is false, it ensures that the point representation is uncompressed.