function stringToArrayBuffer(s) {
	let len = s.length;
	let buf = new ArrayBuffer(len);
	let view = new Uint8Array(buf);

	for (let i = 0; i < len; ++i) {
		view[i] = s.charCodeAt(i);
	}

	return buf;
}

function arrayBufferToHex(buf) {
	let s = '';
	const view = new Uint8Array(buf);

	for (let c of view) {
		const hex = c.toString(16);
		s += hex.length === 1 ? '0' + hex : hex;
	}

	return s;
}

function cbcMacHash(data, key) {
	const subtle = window.crypto.subtle;
	const algorithm = 'AES-CBC';
	const blockSize = 16;

	const options = {
		name: algorithm
	};

	return subtle.importKey('raw', key, options, false, ['encrypt'])
		.then(function (key) {
			const iv = new Uint8Array(blockSize);

			const options = {
				name: algorithm,
				iv: iv
			};

			return subtle.encrypt(options, key, data);
		}).then(ciphertext => arrayBufferToHex(ciphertext.slice(-blockSize)));
}

let data = stringToArrayBuffer('alert(\'MZA who was that?\');\n');
let key = stringToArrayBuffer('YELLOW SUBMARINE');
let expectedHash = '296b8d7cb78a243dda4d0a61d33bbdd1';

cbcMacHash(data, key).then(actualHash => alert(actualHash === expectedHash));

@@ -193,24 +193,125 @@
 urn buf;%0A%7D%0A%0A
+function arrayBufferToString(buf) %7B%0A%09return String.fromCharCode.apply(null, new Uint8Array(buf));%0A%7D%0A%0A
 function arr
@@ -924,33 +924,16 @@
 text =%3E 
-arrayBufferToHex(
 cipherte
@@ -957,81 +957,163 @@
 ze))
-)
 ;%0A%7D%0A%0A
-let data = stringToArrayBuffer('alert(%5C'MZA who was that?%5C');%5Cn');%0A
+fetch('https://raw.githubusercontent.com/Metalnem/cryptopals-go/master/challenge50.dat')%0A%09.then(response =%3E response.arrayBuffer())%0A%09.then(buf =%3E %7B%0A%09%09
 let 
@@ -1159,16 +1159,18 @@
 RINE');%0A
+%09%09
 let expe
@@ -1217,16 +1217,25 @@
 bdd1';%0A%0A
+%09%09return 
 cbcMacHa
@@ -1233,28 +1233,27 @@
  cbcMacHash(
-data
+buf
 , key).then(
@@ -1270,13 +1270,33 @@
  =%3E 
-alert
+%7B%0A%09%09%09if (arrayBufferToHex
 (act
@@ -1302,16 +1302,17 @@
 tualHash
+)
  === exp
@@ -1321,11 +1321,166 @@
 tedHash)
+ %7B%0A%09%09%09%09var script = document.createElement('script');%0A%09%09%09%09script.innerHTML = arrayBufferToString(buf);%0A%09%09%09%09document.head.appendChild(script);%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D
 );%0A

Implement web page that downloads script and appends it to DOM if it's hash matches expected