TPLSM2Int
Data types, cryptography
Description
TPLSM2Int is the fixed-size 256-bit unsigned integer used throughout the SM2 suite. The W array holds eight 32-bit words; W[0] is the least significant word and W[7] the most significant.
Field elements, private scalars, point coordinates and curve constants all use this record. PLSM2HexToValue, PLSM2IntToBE32 and PLSM2BE32ToInt convert between the record, hexadecimal text and 32-byte big-endian strings.
The record does not enforce a value range; callers must keep field elements below the curve modulus and scalars within the range the routine documents.
Syntax
Delphi
TPLSM2Int = Record
W: Array [0.. 7] Of UInt32;
End;Fields
| W | Eight 32-bit words, least significant first |
|---|
Remarks
PLSM2HexToValue requires exactly 64 hexadecimal characters and zeroes the record when the length or a digit is invalid; upper- and lower-case digits are both accepted.
PLSM2BE32ToInt requires exactly 32 bytes and leaves the record zeroed for any other length, so a nonce source must return exactly 32 bytes.
PLSM2IntToBE32 always emits 32 bytes, including leading zero bytes, so its output can feed SM2 message construction directly.
PLSM2PointOnCurve rejects coordinates at or above P; PLSM2Sign and PLSM2Verify reject scalar values at or above N.
The record has no managed fields, and the arithmetic routines use the eight words as supplied without renormalising them.
See also
PLSM2HexToValue, PLSM2IntToBE32, PLSM2BE32ToInt, PLSM2PublicKeyFromPrivate, PLSM2Sign