(string)
| 1 | function stringToArrayBuffer(string) { |
| 2 | const base64String = unescape(encodeURIComponent(string)); |
| 3 | const charList = base64String.split(""); |
| 4 | const arrayBuffer = []; |
| 5 | for (let i = 0; i < charList.length; i += 1) { |
| 6 | arrayBuffer.push(charList[i].charCodeAt(0)); |
| 7 | } |
| 8 | return new Uint8Array(arrayBuffer); |
| 9 | } |
| 10 | |
| 11 | function arrayBufferToHex(arrayBuffer) { |
| 12 | const byteArray = new Uint8Array(arrayBuffer); |
no outgoing calls
no test coverage detected