scalarReduceConst static method
reduce scalar constant-time
Implementation
static List<int> scalarReduceConst(List<int> scalar) {
List<int> r = List<int>.filled(Ed25519KeysConst.privKeyByteLen, 0);
if (scalar.length == Ed25519KeysConst.privKeyByteLen) {
CryptoOps.scReduce32Copy(r, scalar);
} else if (scalar.length == Ed25519KeysConst.privKeyByteLen * 2) {
CryptoOps.scReduce(r, scalar);
} else {
throw CryptoException("Invalid scalar length.");
}
return r;
}