MCPcopy Create free account
hub / github.com/lesspass/lesspass / stringToArrayBuffer

Function stringToArrayBuffer

packages/lesspass-entropy/src/stringEncoding.js:1–9  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

1function 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
11function arrayBufferToHex(arrayBuffer) {
12 const byteArray = new Uint8Array(arrayBuffer);

Callers 2

pbkdf2.browser.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected