Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
node_modules
package-lock.json
notes.txt
example/test.js
node-net-snmp.iml
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ function oidFollowsOid (oidString, nextString) {
}

function oidInSubtree (oidString, nextString) {
if (!nextString) return false;
var oid = oidString.split (".");
var next = nextString.split (".");

Expand Down Expand Up @@ -1307,7 +1308,7 @@ Authentication.calculateDigest = function (messageBuffer, authProtocol, authPass
var hmacAlgorithm = crypto.createHmac (cryptoAlgorithm, authKey);
hmacAlgorithm.update (messageBuffer);
var digest = hmacAlgorithm.digest ();
return digest.subarray (0, Authentication.algorithms[authProtocol].AUTHENTICATION_CODE_LENGTH);
return Buffer.from(digest.subarray (0, Authentication.algorithms[authProtocol].AUTHENTICATION_CODE_LENGTH));
};

var Encryption = {};
Expand Down Expand Up @@ -1778,9 +1779,9 @@ Message.prototype.checkAuthentication = function (user, responseCb) {
Message.prototype.setMsgFlags = function (bitPosition, flag) {
if ( this.msgGlobalData && this.msgGlobalData !== undefined && this.msgGlobalData !== null ) {
if ( flag ) {
this.msgGlobalData.msgFlags = this.msgGlobalData.msgFlags | ( 2 ** bitPosition );
this.msgGlobalData.msgFlags = this.msgGlobalData.msgFlags | ( Math.pow(2, bitPosition) );
} else {
this.msgGlobalData.msgFlags = this.msgGlobalData.msgFlags & ( 255 - 2 ** bitPosition );
this.msgGlobalData.msgFlags = this.msgGlobalData.msgFlags & ( 255 - Math.pow(2, bitPosition) );
}
}
};
Expand Down