Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Use unbalanced feistel ciphers to improve performance #8

Open
ioleo opened this issue Feb 17, 2016 · 0 comments
Open

Use unbalanced feistel ciphers to improve performance #8

ioleo opened this issue Feb 17, 2016 · 0 comments

Comments

@ioleo
Copy link
Owner

ioleo commented Feb 17, 2016

Currently the cipher operates on 2n powers of 2, becouse to produce a balanced feistel cipher an even number of bits (divisible into 2) is required. However this costs performance, becouse to make sure the output is smaller than maxValue we have to repeat encryption/decryption until the result fits.
The larger the gap between 0 and minValue and maxValue and 2n - the more iterations on average it will take.

Luby and Rackoff have proved that if we use the next power of 2 greater or equal to maxValue the number of operations (on average) required to produce the result will be 2.

Current implementation uses the "closest EVEN" power of 2.

This is probably not a big issue, as this library is blazingly fast anyways, but should be investigated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant