Showing 5 of 7 total issues
Function _redc
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default function _redc(b, k, N, Ni, Nj, M, Mi, Mj, T, Ti, Tj) {
Function inv
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
inv(aRmodN) {
// The modular inverse
// Compute (aR mod N)^-1 using Euclidean algo
const ai = n_trim_positive(aRmodN, 0, this.k);
Function _montgomery
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function _montgomery(b, N) {
assert(N.length > 0);
assert(N[0] !== 0);
const k = N.length;
Function _mul
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default function _mul(r, N, M, a, b, c) {
Function pown
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
pown(aRmodN, x) {
// Modular
// exponentiation can be done using exponentiation by squaring by initializing the
// initial product to the Montgomery representation of 1, that is, to R mod N, and
// by replacing the multiply and square steps by Montgomery multiplies.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"