evilaliv3/scrypt-async-js

View on GitHub

Showing 17 of 17 total issues

Function scrypt has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

function scrypt(password, salt, logN, r, dkLen, interruptStep, callback, encoding) {
  'use strict';

  function SHA256(m) {
    /** @const */ var K = [
Severity: Minor
Found in scrypt-async.js - About 2 days 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 scrypt has 358 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function scrypt(password, salt, logN, r, dkLen, interruptStep, callback, encoding) {
  'use strict';

  function SHA256(m) {
    /** @const */ var K = [
Severity: Major
Found in scrypt-async.js - About 1 day to fix

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

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

      File scrypt-async.js has 362 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * Fast "async" scrypt implementation in JavaScript.
       * Copyright (c) 2013-2015 Dmitry Chestnykh | BSD License
       * https://github.com/dchest/scrypt-async-js
       */
      Severity: Minor
      Found in scrypt-async.js - About 4 hrs to fix

        Function SHA256 has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function SHA256(m) {
            /** @const */ var K = [
              0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
              0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
              0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
        Severity: Major
        Found in scrypt-async.js - About 3 hrs to fix

          Function salsaXOR has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function salsaXOR(tmp, B, bin, bout) {
              var j0  = tmp[0]  ^ B[bin++],
                  j1  = tmp[1]  ^ B[bin++],
                  j2  = tmp[2]  ^ B[bin++],
                  j3  = tmp[3]  ^ B[bin++],
          Severity: Major
          Found in scrypt-async.js - About 2 hrs to fix

            Function blocks has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function blocks(p) {
                  var off = 0, len = p.length;
                  while (len >= 64) {
                    var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7,
                        u, i, j, t1, t2;
            Severity: Minor
            Found in scrypt-async.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                        t2 = ((((a>>>2) | (a<<(32-2))) ^ ((a>>>13) | (a<<(32-13))) ^
                             ((a>>>22) | (a<<(32-22)))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;
              Severity: Major
              Found in scrypt-async.js and 1 other location - About 1 hr to fix
              scrypt-async.js on lines 79..80

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                        t1 = ((((((e>>>6) | (e<<(32-6))) ^ ((e>>>11) | (e<<(32-11))) ^
                             ((e>>>25) | (e<<(32-25)))) + ((e & f) ^ (~e & g))) | 0) +
              Severity: Major
              Found in scrypt-async.js and 1 other location - About 1 hr to fix
              scrypt-async.js on lines 83..84

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function PBKDF2_HMAC_SHA256_OneIter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) {
                  // compress password if it's longer than hash block length
                  password = password.length <= 64 ? password : SHA256(password);
              
                  var i, innerLen = 64 + salt.length + 4,
              Severity: Minor
              Found in scrypt-async.js - About 1 hr to fix

                Function scrypt has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function scrypt(password, salt, logN, r, dkLen, interruptStep, callback, encoding) {
                Severity: Major
                Found in scrypt-async.js - About 1 hr to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                            t2 = ((u>>>7) | (u<<(32-7))) ^ ((u>>>18) | (u<<(32-18))) ^ (u>>>3);
                  Severity: Minor
                  Found in scrypt-async.js and 1 other location - About 50 mins to fix
                  scrypt-async.js on lines 70..70

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 51.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                            t1 = ((u>>>17) | (u<<(32-17))) ^ ((u>>>19) | (u<<(32-19))) ^ (u>>>10);
                  Severity: Minor
                  Found in scrypt-async.js and 1 other location - About 50 mins to fix
                  scrypt-async.js on lines 73..73

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 51.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    function blockMix(tmp, B, bin, bout, r) {
                  Severity: Minor
                  Found in scrypt-async.js - About 35 mins to fix

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

                      function blockXOR(dst, di, src, si, len) {
                    Severity: Minor
                    Found in scrypt-async.js - About 35 mins to fix

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

                        function blockCopy(dst, di, src, si, len) {
                      Severity: Minor
                      Found in scrypt-async.js - About 35 mins to fix

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

                          function interruptedFor(start, end, step, fn, donefn) {
                        Severity: Minor
                        Found in scrypt-async.js - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language