indutny/elliptic

View on GitHub

Showing 67 of 136 total issues

File secp256k1.js has 780 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module.exports = {
  doubles: {
    step: 4,
    points: [
      [
Severity: Major
Found in lib/elliptic/precomputed/secp256k1.js - About 1 day to fix

    File short.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var utils = require('../utils');
    var BN = require('bn.js');
    var inherits = require('inherits');
    Severity: Major
    Found in lib/elliptic/curve/short.js - About 1 day to fix

      Function exports has 185 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(grunt) {
        grunt.initConfig({
          browserify: {
            unittests: {
              files: {
      Severity: Major
      Found in Gruntfile.js - About 7 hrs to fix

        Function _wnafMulAdd has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

        BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
          points,
          coeffs,
          len,
          jacobianResult) {
        Severity: Minor
        Found in lib/elliptic/curve/base.js - About 6 hrs to fix

        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"

        Further reading

        Function getJSF has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        function getJSF(k1, k2) {
          var jsf = [
            [],
            [],
          ];
        Severity: Minor
        Found in lib/elliptic/utils.js - About 3 hrs to fix

        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"

        Further reading

        Function _wnafMulAdd has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
          points,
          coeffs,
          len,
          jacobianResult) {
        Severity: Major
        Found in lib/elliptic/curve/base.js - About 3 hrs to fix

          File edwards.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          var utils = require('../utils');
          var BN = require('bn.js');
          var inherits = require('inherits');
          Severity: Minor
          Found in lib/elliptic/curve/edwards.js - About 3 hrs to fix

            File base.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            var BN = require('bn.js');
            var utils = require('../utils');
            var getNAF = utils.getNAF;
            Severity: Minor
            Found in lib/elliptic/curve/base.js - About 3 hrs to fix

              Function sign has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              EC.prototype.sign = function sign(msg, key, enc, options) {
                if (typeof enc === 'object') {
                  options = enc;
                  enc = null;
                }
              Severity: Minor
              Found in lib/elliptic/ec/index.js - About 2 hrs to fix

              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"

              Further reading

              Function _importDER has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              Signature.prototype._importDER = function _importDER(data, enc) {
                data = utils.toArray(data, enc);
                var p = new Position();
                if (data[p.place++] !== 0x30) {
                  return false;
              Severity: Minor
              Found in lib/elliptic/ec/signature.js - About 2 hrs to fix

              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"

              Further reading

              Function _wnafMul has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
                var w = 4;
              
                // Precompute window
                var nafPoints = p._getNAFPoints(w);
              Severity: Minor
              Found in lib/elliptic/curve/base.js - About 2 hrs to fix

              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"

              Further reading

              Function _getEndoBasis has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
                // aprxSqrt >= sqrt(this.n)
                var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
              
                // 3.74
              Severity: Major
              Found in lib/elliptic/curve/short.js - About 2 hrs to fix

                Function Point has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                function Point(curve, x, y, z, t) {
                  Base.BasePoint.call(this, curve, 'projective');
                  if (x === null && y === null && z === null) {
                    this.x = this.curve.zero;
                    this.y = this.curve.one;
                Severity: Minor
                Found in lib/elliptic/curve/edwards.js - About 2 hrs to fix

                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"

                Further reading

                Function _importDER has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Signature.prototype._importDER = function _importDER(data, enc) {
                  data = utils.toArray(data, enc);
                  var p = new Position();
                  if (data[p.place++] !== 0x30) {
                    return false;
                Severity: Major
                Found in lib/elliptic/ec/signature.js - About 2 hrs to fix

                  Function getJSF has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function getJSF(k1, k2) {
                    var jsf = [
                      [],
                      [],
                    ];
                  Severity: Minor
                  Found in lib/elliptic/utils.js - About 1 hr to fix

                    Function sign has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    EC.prototype.sign = function sign(msg, key, enc, options) {
                      if (typeof enc === 'object') {
                        options = enc;
                        enc = null;
                      }
                    Severity: Minor
                    Found in lib/elliptic/ec/index.js - About 1 hr to fix

                      Function _getEndomorphism has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
                        // No efficient endomorphism
                        if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
                          return;
                      
                      
                      Severity: Minor
                      Found in lib/elliptic/curve/short.js - About 1 hr to fix

                      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"

                      Further reading

                      Function dblp has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      JPoint.prototype.dblp = function dblp(pow) {
                        if (pow === 0)
                          return this;
                        if (this.isInfinity())
                          return this;
                      Severity: Minor
                      Found in lib/elliptic/curve/short.js - About 1 hr to fix

                        Function _getEndomorphism has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
                          // No efficient endomorphism
                          if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
                            return;
                        
                        
                        Severity: Minor
                        Found in lib/elliptic/curve/short.js - About 1 hr to fix

                          Function _threeDbl has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          JPoint.prototype._threeDbl = function _threeDbl() {
                            var nx;
                            var ny;
                            var nz;
                            // Z = 1
                          Severity: Minor
                          Found in lib/elliptic/curve/short.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language