(index: number, b: number, c: number, d: number)
| 182 | } |
| 183 | |
| 184 | function fk(index: number, b: number, c: number, d: number): [number, number] { |
| 185 | if (index < 20) { |
| 186 | return [(b & c) | (~b & d), 0x5a827999]; |
| 187 | } |
| 188 | |
| 189 | if (index < 40) { |
| 190 | return [b ^ c ^ d, 0x6ed9eba1]; |
| 191 | } |
| 192 | |
| 193 | if (index < 60) { |
| 194 | return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc]; |
| 195 | } |
| 196 | |
| 197 | return [b ^ c ^ d, 0xca62c1d6]; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Compute the fingerprint of the given string |