indutny/elliptic

View on GitHub

Showing 67 of 136 total issues

Function _zeroDbl has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Function _projDbl has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Point.prototype._projDbl = function _projDbl() {
      // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
      //     #doubling-dbl-2008-bbjlp
      //     #doubling-dbl-2007-bl
      // and others
    Severity: Minor
    Found in lib/elliptic/curve/edwards.js - About 1 hr to fix

      Function _fixedNafMul has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
        assert(p.precomputed);
        var doubles = p._getDoubles();
      
        var naf = getNAF(k, 1, this._bitLength);
      Severity: Minor
      Found in lib/elliptic/curve/base.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 trpl has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      JPoint.prototype.trpl = function trpl() {
        if (!this.curve.zeroA)
          return this.dbl().add(this);
      
        // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
      Severity: Minor
      Found in lib/elliptic/curve/short.js - About 1 hr to fix

        Function _wnafMul has 29 lines of code (exceeds 25 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 1 hr to fix

          Function dblp has a Cognitive Complexity of 10 (exceeds 5 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

          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 Point has 27 lines of code (exceeds 25 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 1 hr to fix

            Function _fixedNafMul has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
              assert(p.precomputed);
              var doubles = p._getDoubles();
            
              var naf = getNAF(k, 1, this._bitLength);
            Severity: Minor
            Found in lib/elliptic/curve/base.js - About 1 hr to fix

              Function verify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              EC.prototype.verify = function verify(msg, signature, key, enc, options) {
                if (!options)
                  options = {};
              
                msg = this._truncateToN(msg, false, options.msgBitLength);
              Severity: Minor
              Found in lib/elliptic/ec/index.js - About 45 mins 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 getNAF has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function getNAF(num, w, bits) {
                var naf = new Array(Math.max(num.bitLength(), bits) + 1);
                var i;
                for (i = 0; i < naf.length; i += 1) {
                  naf[i] = 0;
              Severity: Minor
              Found in lib/elliptic/utils.js - About 45 mins 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 a Cognitive Complexity of 8 (exceeds 5 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: Minor
              Found in lib/elliptic/curve/short.js - About 45 mins 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 decodePoint has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
                bytes = utils.toArray(bytes, enc);
              
                var len = this.p.byteLength();
              
              
              Severity: Minor
              Found in lib/elliptic/curve/base.js - About 45 mins 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 Point has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function Point(curve, x, y, isRed) {
                Base.BasePoint.call(this, curve, 'affine');
                if (x === null && y === null) {
                  this.x = null;
                  this.y = null;
              Severity: Minor
              Found in lib/elliptic/curve/short.js - About 45 mins 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 Point has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function Point(curve, x, y, z, t) {
              Severity: Minor
              Found in lib/elliptic/curve/edwards.js - About 35 mins to fix

                Function verify has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                EC.prototype.verify = function verify(msg, signature, key, enc, options) {
                Severity: Minor
                Found in lib/elliptic/ec/index.js - About 35 mins to fix

                  Function _wnafMulAdd has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

                    Function genKeyPair has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    EC.prototype.genKeyPair = function genKeyPair(options) {
                      if (!options)
                        options = {};
                    
                      // Instantiate Hmac_DRBG
                    Severity: Minor
                    Found in lib/elliptic/ec/index.js - About 35 mins 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 Point has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function Point(curve, x, z) {
                      Base.BasePoint.call(this, curve, 'projective');
                      if (x === null && z === null) {
                        this.x = this.curve.one;
                        this.z = this.curve.zero;
                    Severity: Minor
                    Found in lib/elliptic/curve/mont.js - About 35 mins 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 Signature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function Signature(eddsa, sig) {
                      this.eddsa = eddsa;
                    
                      if (typeof sig !== 'object')
                        sig = parseBytes(sig);
                    Severity: Minor
                    Found in lib/elliptic/eddsa/signature.js - About 35 mins 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 BaseCurve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function BaseCurve(type, conf) {
                      this.type = type;
                      this.p = new BN(conf.p, 16);
                    
                      // Use Montgomery, when there is no fast reduction for the prime
                    Severity: Minor
                    Found in lib/elliptic/curve/base.js - About 35 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language