cryptico icon indicating copy to clipboard operation
cryptico copied to clipboard

some variable is not define && use UMD for automated build systems

Open joe223 opened this issue 8 years ago • 2 comments

Some variable and window window.navigator is not defined in Node.js. This will causes some errors. eg.

my.pad16 = function(bytes)
    {
        var newBytes = bytes.slice(0);
        var padding = (16 - (bytes.length % 16)) % 16;
        for(i = bytes.length; i < bytes.length + padding; i++)
        {
            newBytes.push(0);
        }
        return newBytes;
    }

i is not defined.

joe223 avatar Feb 07 '17 12:02 joe223

You have to declare 'i' as a variable the first time you use it.

my.pad16 = function(bytes) { var newBytes = bytes.slice(0); var padding = (16 - (bytes.length % 16)) % 16; for(var i = bytes.length; i < bytes.length + padding; i++) { newBytes.push(0); } return newBytes; }

JDSlimz avatar Mar 21 '19 18:03 JDSlimz

@JDSlimz I have made a new commit. It update pad16 function

joe223 avatar Mar 22 '19 02:03 joe223