Removed dependency for Utils.js from NetBIOS.js

This commit is contained in:
n1474335 2017-12-19 13:53:33 +00:00
parent df122da1d2
commit e61ced93d6

View file

@ -1,5 +1,3 @@
import Utils from "../Utils.js";
/** /**
* NetBIOS operations. * NetBIOS operations.
* *
@ -29,14 +27,13 @@ const NetBIOS = {
offset = args[0]; offset = args[0];
if (input.length <= 16) { if (input.length <= 16) {
let len = input.length;
input.length = 16;
input.fill(32, len, 16);
for (let i = 0; i < input.length; i++) { for (let i = 0; i < input.length; i++) {
output.push((input[i] >> 4) + offset); output.push((input[i] >> 4) + offset);
output.push((input[i] & 0xf) + offset); output.push((input[i] & 0xf) + offset);
} }
for (let i = input.length; i < 16; i++) {
output.push(67);
output.push(65);
}
} }
return output; return output;
@ -59,7 +56,7 @@ const NetBIOS = {
output.push((((input[i] & 0xff) - offset) << 4) | output.push((((input[i] & 0xff) - offset) << 4) |
(((input[i + 1] & 0xff) - offset) & 0xf)); (((input[i + 1] & 0xff) - offset) & 0xf));
} }
output = Utils.strToByteArray(Utils.byteArrayToChars(output).trim()); output = output.filter(x => x !== 32);
} }
return output; return output;