move wordArrayToBuffer to wtvshared

This commit is contained in:
zefie
2025-07-24 15:28:59 -04:00
parent 5bbaa63e98
commit 87475c9fc0
3 changed files with 245 additions and 307 deletions

View File

@@ -53,6 +53,16 @@ class WTVShared {
}
}
/**
* convert a CryptoJS.lib.WordArray to a Javascript Buffer
* @param {CryptoJS.lib.WordArray} wordArray
* @returns {Buffer} JS Buffer object
*/
wordArrayToBuffer(wordArray) {
if (wordArray) return new Buffer.from(wordArray.toString(CryptoJS.enc.Hex), 'hex');
else return null;
}
/**
* Converts an IP address to a hexadecimal string (WTV)
* @param {string} ip The IP address to convert