(rounds)
| 141 | // with a plain linear scan it is O(n²) to build or read them all. |
| 142 | describe('hash collisions', () => { |
| 143 | function collisionKeys(rounds) { |
| 144 | let keys = ['']; |
| 145 | for (let i = 0; i < rounds; i++) { |
| 146 | const next = []; |
| 147 | for (let j = 0; j < keys.length; j++) { |
| 148 | next.push(keys[j] + 'Aa'); |
| 149 | next.push(keys[j] + 'BB'); |
| 150 | } |
| 151 | keys = next; |
| 152 | } |
| 153 | return keys; |
| 154 | } |
| 155 | |
| 156 | [8, 10, 12].forEach((rounds) => { |
| 157 | const keys = collisionKeys(rounds); |