{
const gpu = new GPU();
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
const plaintext = 'helloworld';
const plaintextIntegerArray = plaintext.split('').map(letter => alphabet.indexOf(letter));
const caesarCipher = gpu.createKernel(function (plaintextIntegerArray, alphabetLength) {
return (plaintextIntegerArray[this.thread.x] + this.thread.y) % alphabetLength;
})
.setOutput([plaintext.length, alphabet.length]);
return caesarCipher(plaintextIntegerArray, alphabet.length)
.map(ciphertexts => [...ciphertexts]
.map(index => alphabet[index]).join(''));
}