evilaliv3/scrypt-async-js

View on GitHub

Showing 13 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

              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

                  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