# Random permutation of bit strings of length $n$, where $n$ can be any positive integer?

I need an efficient, invertible random permutation of $$n$$-bit strings, defined by a $$128$$-bit key. $$n$$ can be any positive integer from $$6$$ to $$128$$. I have no requirements on the security of the permutation; only that it is random (i.e. that outputs for different keys are uncorrelated).

Many standard algorithms exist for $$n$$ of $$32$$, $$64$$, and $$128$$ bits. I wondered if the Sponge Construction of Keccak could be used to transform such permutations into $$n$$-bit permutations. I understand the sponge construction generates a function of variable input length and arbitrary output length. However, it is not clear that if I use it to generate a function to turn one $$n$$-bit string into another $$n$$-bit string, that that function will encode a random permutation. Does it?

• See "Format Preserving Encryption" for standard ways of doing precisely what you're looking for – poncho Jan 17 '19 at 21:44