src/aes.js
function encryptBlock(block, keySchedule) {
	let state = splitToMatrix(block);

	state = a_u.addRoundKey(state, keySchedule.slice(0, 4));
	let rounds = keySchedule.length / COLUMNS;
	for (let round = 1; round < rounds; round++){
		state = a_u.subBytes(state);
		state = a_u.shiftRows(state);
		state = a_u.mixColumns(state);
		state = a_u.addRoundKey(state, keySchedule.slice(round * COLUMNS, (round + 1) * COLUMNS));
	}
	state = a_u.subBytes(state);
	state = a_u.shiftRows(state);
	state = a_u.addRoundKey(state, keySchedule.slice(COLUMNS * (rounds-1), COLUMNS * rounds));    
	
	return getBlockFromState(state);
}
function encryptBlock(block, keySchedule) {
	let state = splitToMatrix(block);

	state = a_u.addRoundKey(state, keySchedule.slice(0, 4));
	let rounds = keySchedule.length / COLUMNS;
	for (let round = 1; round < rounds; round++){
		state = a_u.subBytes(state);
		state = a_u.shiftRows(state);
		state = a_u.mixColumns(state);
		state = a_u.addRoundKey(state, keySchedule.slice(round * COLUMNS, (round + 1) * COLUMNS));
	}
	state = a_u.subBytes(state);
	state = a_u.shiftRows(state);
	state = a_u.addRoundKey(state, keySchedule.slice(COLUMNS * (rounds-1), COLUMNS * rounds));    
	
	return getBlockFromState(state);
}
function encryptBlock ( block , keySchedule ) { let state = splitToMatrix ( block ) ; state = a_u . addRoundKey ( state , keySchedule . slice ( 0 , 4 ) ) ; let rounds = keySchedule . length / COLUMNS ; for ( let round = 1 ; round < rounds ; round ++ ) { state = a_u . subBytes ( state ) ; state = a_u . shiftRows ( state ) ; state = a_u . mixColumns ( state ) ; state = a_u . addRoundKey ( state , keySchedule . slice ( round * COLUMNS , ( round + 1 ) * COLUMNS ) ) ; } state = a_u . subBytes ( state ) ; state = a_u . shiftRows ( state ) ; state = a_u . addRoundKey ( state , keySchedule . slice ( COLUMNS * ( rounds - 1 ) , COLUMNS * rounds ) ) ; return getBlockFromState ( state ) ; }
Encrypts given block
Encrypts given block