To encrypt a value from a set (say a range of years from 1001 to 2001)
Rank the set
{0 = 1001, 1 = 1002, 2 = 1003...999 = 2001}
Take the value you want to encrypt from the set (year = 1995) and determine the ranked value = 996
convert this to binary 996 = 1111100100
Encrypt binary value using FPE(1111100100) = En where n is the iteration
If En lands outside desired maximum of 999, take En and encrypt again FPE(En) = En+1
Stop when En+1 is inside range 0 - 999, else repeat step 5
Questions,
Is this the correct way to perform cycle walking using any FPE?
What is the smallest probability of landing outside the desired range? What is the largest?
Note: In my case I'm using BPS as my FPE which has the restriction of at least two 'characters' as input so for binary number the smallest input values possible would be 00, 01, 10, or 11. In decimal this is 0, 1, 2, 3. Therefore the smallest range you can create from these values is 0 - 1. So the probability of landing outside those two values would be 50%. Is this correct?
Would 50% be the max probability of landing outside the smallest range - with the probability getting smaller as the range increases?