UNPKG

@n3okill/utils

Version:
18 lines 809 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.xorTokens = xorTokens; const detectEncoding_1 = require("./detectEncoding"); const toString_1 = require("./toString"); const xorTokens_1 = require("../string/xorTokens"); /** * Returns the XOR result of two Buffer's. * If the two Buffer's are of different lengths, the shorter one will be padded to the length of the longer one. * @param token1 * @param token2 * @return the XOR result */ function xorTokens(token1, token2) { const encoding = (0, detectEncoding_1.detectEncoding)(token1); return Buffer.from((0, xorTokens_1.xorTokens)((0, toString_1.toString)(token1, encoding), (0, toString_1.toString)(token2, (0, detectEncoding_1.detectEncoding)(token2))), encoding); } //# sourceMappingURL=xorTokens.js.map