Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Conversation

@joe223
Copy link

@joe223 joe223 commented Feb 7, 2017

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.

@JDSlimz
Copy link

JDSlimz commented Mar 21, 2019

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;
}

@joe223
Copy link
Author

joe223 commented Mar 22, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants