in practise, this might even be an advantage, since it allows a quick check (e.g. More specifically, the last position of the code will never contain some characters of the alphabet. Feistel ciphers work in several rounds. Crypt(crypt(x)x for each x in the input domain (0.230-1 in this implementation).
But also note, that the shown implementation is in no way secure in a cryptographical sense! See also this question. An example for this step in C const string alphabet static string couponCode(uint number) StringBuilder b new StringBuilder for (int i0; i 6; i) 5)-1 number number 5; return String static uint codeFromCoupon(string coupon) uint n 0; for (int i 0; i 6; i). In the the second step, the number of bits that can be encoded using a given alphabet depends on the "size" of chosen alphabet and the length of the coupon code. Feistel cipher with a round function of your choice). To prevent anyone from entering just some random code, you should define some kind of restictions on the input number. This can be seen as a drawback, because it narrows down the set of valid codes in an obvious way. During each round, some round function is applied to one half of the input, the result is xored with the other half and the two halves are swapped. Also it's cheap in terms of performance requirements.