| P | : | 256-byte table storing the permutation | |
| s | : | 8-bit variable initialized by the VMPC Key Scheduling Algorithm | |
| n | : | 8-bit variable |
| 1. Set n to 0 |
|
2. Add modulo 256 n-th element of P to s 3. Set s to s-th element of P 4. Output s-th element of permutation VMPC(P) 5. Swap n-th element of P with s-th element of P 6. Increment modulo 256 n |
| 7. Go to step 2 if more output is needed |
|
To generate Len bytes of output, execute: 1. n = 0 2. Repeat steps 3-6 Len times: 3. s = P[ (s + P[n]) and 255 ] 4. Output = P[ (P[P[s]]+1) and 255 ] 5. Temp = P[n] P[n] = P[s] P[s] = Temp 6. n = (n + 1) and 255 |
| c | : | fixed length of the cryptographic key in bytes, c in {16...64} | |
| K | : | c-element table storing the cryptographic key | |
| z | : | fixed length of the Initialization Vector in bytes, z in {16...64} | |
| V | : | z-element table storing the Initialization Vector | |
| m | : | 16-bit variable |
|
1. Set s to 0 2. Set i-th element of P to i for i in {0,1,...,255} |
|
3. Set m to 0 4. Add modulo 256 (m modulo 256)-th element of P to s 5. Add modulo 256 (m modulo c)-th element of K to s 6. Set s to s-th element of P 7. Swap (m modulo 256)-th element of P with s-th element of P 8. Increment m 9. Go to step 4 if m is lower than 768 |
| 10. If Initialization Vector is not used: terminate the algorithm |
|
11. Set m to 0 12. Add modulo 256 (m modulo 256)-th element of P to s 13. Add modulo 256 (m modulo z)-th element of V to s 14. Set s to s-th element of P 15. Swap (m modulo 256)-th element of P with s-th element of P 16. Increment m 17. Go to step 12 if m is lower than 768 |
|
1. s = 0 2. for i from 0 to 255: P[i]=i 3. for m from 0 to 767: execute steps 4-6: 4. n = m and 255 5. s = P[ (s + P[n] + K[m mod c]) and 255 ] 6. Temp = P[n] P[n] = P[s] P[s] = Temp 7. If Initialization Vector is used: execute step 8: 8. for m from 0 to 767: execute steps 9-11: 9. n = m and 255 10. s = P[ (s + P[n] + V[m mod z]) and 255 ] 11. Temp = P[n] P[n] = P[s] P[s] = Temp |
| Key (hex) |
96, 61, 41, 0A, B7, 97, D8, A9, EB, 76, 7C, 21, 17, 2D, F6, C7 | |||||||
| Initialization Vector (hex) |
4B, 5C, 2F, 00, 3E, 67, F3, 95, 57, A8, D2, 6F, 3D, A2, B1, 55 | |||||||
| Output-byte number (dec) |
0 | 1 | 2 | 3 | 252 | 253 | 254 | 255 |
| Output-byte value (hex) |
A8 | 24 | 79 | F5 | B8 | FC | 66 | A4 |
| Output-byte number (dec) |
1020 | 1021 | 1022 | 1023 | 102396 | 102397 | 102398 | 102399 |
| Output-byte value (hex) |
E0 | 56 | 40 | A5 | 81 | CA | 49 | 9A |