This commit is contained in:
2026-06-24 16:28:42 +02:00
commit 1922f2db62
19 changed files with 571 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
export const expandKeyFake = (key: number[][]): number[][][] => {
/**
* @param {string} key - A string of 128, 192, or 256 bits.
* @returns {string[]} An array of round keys.
*/
const N_k = key[0].length // Number of columns in the key matrix (4 for 128-bit, 6 for 192-bit, 8 for 256-bit)
const N_r = N_k + 6 // Number of rounds (10 for 128-bit, 12 for 192-bit, 14 for 256-bit)
const totalKeys = 4 * (N_r + 1) // Total number of 4-byte words required
const expandedKeys: number[][][] = []
for (let i = 0;i < totalKeys / 4;i++) {
const matrix: number[][] = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
]
expandedKeys.push(matrix)
}
return expandedKeys
}