src/aes.js
function expandKey(key) {
	let tempWord = new Array(WORD_LENGTH);
	let rounds = getRoundsCount(key);
	let wordsCount = key.length / WORD_LENGTH;
	let keySchedule = new Array(COLUMNS * (rounds + 1));
	
	for (let i = 0; i < wordsCount; i++) {
		keySchedule[i] = key.slice(WORD_LENGTH * i, WORD_LENGTH * i + WORD_LENGTH);
	}
	for (let i = wordsCount; i < keySchedule.length; i++) {
		tempWord = keySchedule[i - 1];
		if (i % wordsCount === 0) {
			tempWord = a_u.xorWords(a_u.subWord(a_u.rotWordLeft(tempWord)), a_u.R_CON[i / wordsCount]);
		} else if (wordsCount > 6 && i % wordsCount === 4) {
			tempWord = a_u.subWord(tempWord);
		}
		keySchedule[i] = a_u.xorWords(keySchedule[i - wordsCount], tempWord);
	}
	return keySchedule;
}
function expandKey(key) {
	let tempWord = new Array(WORD_LENGTH);
	let rounds = getRoundsCount(key);
	let wordsCount = key.length / WORD_LENGTH;
	let keySchedule = new Array(COLUMNS * (rounds + 1));
	
	for (let i = 0; i < wordsCount; i++) {
		keySchedule[i] = key.slice(WORD_LENGTH * i, WORD_LENGTH * i + WORD_LENGTH);
	}
	for (let i = wordsCount; i < keySchedule.length; i++) {
		tempWord = keySchedule[i - 1];
		if (i % wordsCount === 0) {
			tempWord = a_u.xorWords(a_u.subWord(a_u.rotWordLeft(tempWord)), a_u.R_CON[i / wordsCount]);
		} else if (wordsCount > 6 && i % wordsCount === 4) {
			tempWord = a_u.subWord(tempWord);
		}
		keySchedule[i] = a_u.xorWords(keySchedule[i - wordsCount], tempWord);
	}
	return keySchedule;
}
function expandKey ( key ) { let tempWord = new Array ( WORD_LENGTH ) ; let rounds = getRoundsCount ( key ) ; let wordsCount = key . length / WORD_LENGTH ; let keySchedule = new Array ( COLUMNS * ( rounds + 1 ) ) ; for ( let i = 0 ; i < wordsCount ; i ++ ) { keySchedule [ i ] = key . slice ( WORD_LENGTH * i , WORD_LENGTH * i + WORD_LENGTH ) ; } for ( let i = wordsCount ; i < keySchedule . length ; i ++ ) { tempWord = keySchedule [ i - 1 ] ; if ( i % wordsCount === 0 ) { tempWord = a_u . xorWords ( a_u . subWord ( a_u . rotWordLeft ( tempWord ) ) , a_u . R_CON [ i / wordsCount ] ) ; } else if ( wordsCount > 6 && i % wordsCount === 4 ) { tempWord = a_u . subWord ( tempWord ) ; } keySchedule [ i ] = a_u . xorWords ( keySchedule [ i - wordsCount ] , tempWord ) ; } return keySchedule ; }
Generates keys for each round
Generates keys for each round