Home | History | Annotate | Download | only in sunspider-0.9.1

Lines Matching refs:Nb

7  *           2D byte-array key schedule 'w' (Nr+1 x Nb bytes)
14 var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
15 var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
18 for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];
20 state = AddRoundKey(state, w, 0, Nb);
23 state = SubBytes(state, Nb);
24 state = ShiftRows(state, Nb);
25 state = MixColumns(state, Nb);
26 state = AddRoundKey(state, w, round, Nb);
29 state = SubBytes(state, Nb);
30 state = ShiftRows(state, Nb);
31 state = AddRoundKey(state, w, Nr, Nb);
33 var output = new Array(4*Nb); // convert state to 1-d array before returning [§3.4]
34 for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
39 function SubBytes(s, Nb) { // apply SBox to state S [§5.1.1]
41 for (var c=0; c<Nb; c++) s[r][c] = Sbox[s[r][c]];
47 function ShiftRows(s, Nb) { // shift row r of state S left by r bytes [§5.1.2]
50 for (var c=0; c<4; c++) t[c] = s[r][(c+r)%Nb]; // shift into temp copy
52 } // note that this will work for Nb=4,5,6, but not 7,8 (always 4 for AES):
57 function MixColumns(s, Nb) { // combine bytes of each col of state S [§5.1.3]
75 function AddRoundKey(state, w, rnd, Nb) { // xor Round Key into state S [§5.1.4]
77 for (var c=0; c<Nb; c++) state[r][c] ^= w[rnd*4+c][r];
83 function KeyExpansion(key) { // generate Key Schedule (byte-array Nr+1 x Nb) from Key [§5.2]
84 var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
88 var w = new Array(Nb*(Nr+1));
96 for (var i=Nk; i<(Nb*(Nr+1)); i++) {
177 var blockSize = 16; // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
178 var counterBlock = new Array(blockSize); // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
245 var blockSize = 16; // block size fixed at 16 bytes / 128 bits (Nb=4) for AES