IV for FPE/AES
The IV should be specified as Hex-encoded value; where, each Hex value is represented by 2 characters.
Each hex-encoded value of IV must be in the range of 00
to (cardinality-1)
. Cardinality is the number of characters in a character set. For example, when cardinality is 62, the each Hex-encoded value of IV must be in the range 00
to 3D
(hex encode of 62-1=61). 0102030405060708090A0B0C0D0E0F1000303132333435363738393A3B3C3D3D
The IV length is dependent on the cardinality of the character set. The table below provides the cardinality size and the corresponding IV length and block-size to be used in FPE/AES.
Cardinality | IV length and Block-size |
---|---|
10 | 56 |
11 | 54 |
12 | 52 |
13-14 | 50 |
15-16 | 48 |
17-18 | 46 |
19-20 | 44 |
21-23 | 42 |
24-27 | 40 |
28-33 | 38 |
34-40 | 36 |
41-50 | 34 |
51-64 | 32 |
65-84 | 30 |
85-115 | 28 |
116-167 | 26 |
168-255 | 24 |
Note
IV is used only when input data is >block-size.
Following is the formula to calculate block-size and IV length based on a given character set.
The following table provides information about IV length for the predefined character sets.
Character Set | Cardinality | Block-size | IV length | Example |
---|---|---|---|---|
All digits | 10 | 56 | The length of IV should be 56 Hex-encoded values and each Hex value is represents by 2 characters. The required IV length is 112 (56*2) characters. | 0001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405 |
Lower Alphabets | 26 | 40 | The length of IV should be 40 Hex-encoded values and each Hex value is represents by 2 characters. The required IV length is 80 (40*2) characters. | 0102030405060708090a0b0c0d0e0f10111213140102030405060708090a0b0c0d0e0f1011121314 |
Alphanumeric | 62 | 32 | The length of IV should be 32 Hex-encoded values and each Hex value is represents by 2 characters. The required IV length is 64 (32*2) characters. | 0102030405060708090A0B0C0D0E0F1000303132333435363738393A3B3C3D3D |
Printable ascii | 94 | 28 | The length of IV should be 28 Hex-encoded values and each Hex value is represents by 2 characters. The required IV length is 56 (28*2) characters. | 0102030405060708090A0B0C0D0E0F1000303132333435363738393A |