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?

  • 4
    $\begingroup$ What you search is format-preserving encryption. It is generally slower than AES, though. $\endgroup$ Feb 11, 2014 at 22:25
  • $\begingroup$ @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 . $\endgroup$
    – sashank
    Feb 12, 2014 at 6:38

1 Answer 1


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 .

This question has much better answer Is there a length-preserving encryption scheme?

  • $\begingroup$ 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 ? $\endgroup$ Feb 13, 2014 at 22:43
  • $\begingroup$ my last suggestion of , Feistel Networks + Cycle walking should help . please "PRP Luby Rack off revisited" by Naor and Reingold . $\endgroup$
    – sashank
    Feb 13, 2014 at 23:49
  • $\begingroup$ @AlexandreYamajako : $\:$ Perfect Block Ciphers With Small Blocks works in that gap. $\hspace{1.36 in}$ $\endgroup$
    – user991
    Feb 14, 2014 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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