Clarify comment
This commit is contained in:
parent
e57aec63d8
commit
823149ecd9
@ -171,7 +171,8 @@ export function twistedEdwards(curveDef: CurveType): CurveFn {
|
|||||||
this._WINDOW_SIZE = windowSize;
|
this._WINDOW_SIZE = windowSize;
|
||||||
pointPrecomputes.delete(this);
|
pointPrecomputes.delete(this);
|
||||||
}
|
}
|
||||||
// fromHex and other functions returns valid point, but if point is created by user (fromAffine), it can be off curve
|
// Not required for fromHex(), which always creates valid points.
|
||||||
|
// Could be useful for fromAffine().
|
||||||
assertValidity(): void {
|
assertValidity(): void {
|
||||||
const { a, d } = CURVE;
|
const { a, d } = CURVE;
|
||||||
if (this.is0()) throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?
|
if (this.is0()) throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?
|
||||||
|
@ -241,6 +241,8 @@ export function weierstrassPoints<T>(opts: CurvePointsType<T>) {
|
|||||||
if (pz == null || !Fp.isValid(pz)) throw new Error('z required');
|
if (pz == null || !Fp.isValid(pz)) throw new Error('z required');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Does not validate if the point is on-curve.
|
||||||
|
// Use fromHex instead, or call assertValidity() later.
|
||||||
static fromAffine(p: AffinePoint<T>): Point {
|
static fromAffine(p: AffinePoint<T>): Point {
|
||||||
const { x, y } = p || {};
|
const { x, y } = p || {};
|
||||||
if (!p || !Fp.isValid(x) || !Fp.isValid(y)) throw new Error('invalid affine point');
|
if (!p || !Fp.isValid(x) || !Fp.isValid(y)) throw new Error('invalid affine point');
|
||||||
|
Loading…
Reference in New Issue
Block a user