HTTP Gzip Decrypt working

This commit is contained in:
windhamwong@nva-hk.com 2017-07-04 14:30:34 +01:00
parent 90802db3c4
commit b9d33c0618
5 changed files with 50 additions and 0 deletions

View file

@ -344,6 +344,26 @@ const Utils = {
},
/**
* Translates an array of bytes to a hex string.
*
* @param {byteArray} byteArray
* @returns {string}
*
* @example
* // returns "fe09a7"
* Utils.byteArrayToHex([0xfe, 0x09, 0xa7]);
*/
byteArrayToHexNoSpace: function(byteArray) {
if (!byteArray) return "";
let hexStr = "";
for (let i = 0; i < byteArray.length; i++) {
hexStr += Utils.hex(byteArray[i]);
}
return hexStr.slice(0, hexStr.length-1);
},
/**
* Converts a string to a byte array.
* Treats the string as UTF-8 if any values are over 255.