(bytes, keyBytes)
| 23 | } |
| 24 | |
| 25 | function xorCipher(bytes, keyBytes) { |
| 26 | const out = new Uint8Array(bytes.length); |
| 27 | for (let i = 0; i < bytes.length; i++) { |
| 28 | out[i] = bytes[i] ^ keyBytes[i % keyBytes.length]; |
| 29 | } |
| 30 | return out; |
| 31 | } |
| 32 | |
| 33 | function xorEncrypt(plain) { |
| 34 | const data = textEncoder.encode(plain); |
no outgoing calls
no test coverage detected