@dedis/kyber
Version:
A typescript implementation of Kyber interfaces
10 lines (9 loc) • 421 B
TypeScript
import BN from "bn.js";
import { BNType } from "../constants";
/**
* Computes the square root of n mod p if it exists, otherwise null is returned.
* In other words, find x such that x^2 = n mod p, where p must be an odd prime.
* The implementation is adapted from https://rosettacode.org/wiki/Tonelli-Shanks_algorithm#Java
* to reflect the Java library.
*/
export declare function modSqrt(n: BNType, p: BNType): BN;