Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Popular block ciphers like AES or Twofish are keyed pseudo random permutations on the domain $\{0,1,\dots,2^{k}-1\}$ with $k\in\{128,192,256\}$ or similar.

I'm interested in pseudo random permutations on domains whose size is not a power of two: Are there any fast (in the ballpark of AES) keyed pseudo random permutations that operate on $\{0,1,\dots,n\}$ with $n\in\mathbb{N}$ being an adjustable parameter?

share|improve this question
What you search is format-preserving encryption. It is generally slower than AES, though. –  Paŭlo Ebermann Feb 11 at 22:25
@PaŭloEbermann using FPE with AES-NI is comparable speeds with AES-NI. Feistel networks with 10 or so rounds with AES-NI hardly slows it down . –  sashank Feb 12 at 6:38
add comment

1 Answer

up vote 4 down vote accepted

Ciphers with Arbitrary Finite Domains by Black and Rogaway have some options like Prefix Ciphers, Generalized Feistel networks , Cycle walking etc.

Also Format preserving encryption has traits that you are looking for , but NIST standardized ones are patented by Voltage Inc.

In general Feistel networks + Cycle walking would give a good option for any arbitrary length (even or odd) domains .

share|improve this answer
If I may extend the question of the OP the paper you cited states that their methods aren't suitable when the domain $X$ is such that $2^{30}<|X|<2^{60}$ and presents that gap as a open problem. Are you aware of subsequent research that solved ? –  Alexandre Yamajako Feb 13 at 22:43
my last suggestion of , Feistel Networks + Cycle walking should help . please "PRP Luby Rack off revisited" by Naor and Reingold . –  sashank Feb 13 at 23:49
@AlexandreYamajako : $\:$ Perfect Block Ciphers With Small Blocks works in that gap. $\hspace{1.36 in}$ –  Ricky Demer Feb 14 at 20:31
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.