use more Buffer
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
import pako from "pako";
|
||||
import {Buffer} from "buffer";
|
||||
//import {gzip_encode_raw,gzip_decode_raw} from 'wasm-flate';
|
||||
|
||||
const wasmFlate = window.wasm_bindgen;
|
||||
@@ -137,16 +138,10 @@ export function convertHexStringToBase64(hexString) {
|
||||
}
|
||||
|
||||
export function convertHexStringToUint8Array(hexString) {
|
||||
var result = [];
|
||||
for (var i = 0; i < hexString.length; i += 2) {
|
||||
result.push(parseInt(hexString.substr(i, 2), 16));
|
||||
}
|
||||
return Uint8Array.from(result);
|
||||
return Uint8Array.from(Buffer.from(hexString, 'hex'));
|
||||
}
|
||||
export function convertUint8ArrayToHexString(byteArray) {
|
||||
return Array.prototype.map.call(byteArray, function(byte) {
|
||||
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
|
||||
}).join('');
|
||||
return Buffer.from(byteArray).toString('hex');
|
||||
}
|
||||
|
||||
function convertWordArrayToUint8Array(wordArray) {
|
||||
|
||||
Reference in New Issue
Block a user