Skip to main content

Implementation of a Generalized-Feistel Cipher for generating random permutations.

Project description

gfc

build PyPI

Implementation of a Generalized-Feistel Cipher [1, alg. 3] for generating random permutations.
It uses Speck 64/128 as the random function, and can generate permutations up to 2^64.

C API

#include <gfc/gfc.h>
GFC* gfc_init(uint64_t range, uint64_t rounds, uint64_t seed);
void gfc_destroy(GFC* gfc);
uint64_t gfc_decrypt(const GFC* gfc, uint64_t m);
uint64_t gfc_encrypt(const GFC* gfc, uint64_t m);

Python API

from pygfc import Permutation
# Permutation(range, rounds, seed)
perm = Permutation(2 ** 16, 8, 42)
assert set(perm) == set(range(2 ** 16))
assert all(perm.inv(perm[i]) == i for i in range(2 ** 16))

Dependencies

The Speck implementation is from madmo/speck and is licensed under the ISC license (MIT-compatible).

References

[1] Black, John, and Phillip Rogaway. "Ciphers with arbitrary finite domains." Cryptographers’ track at the RSA conference. Springer, Berlin, Heidelberg, 2002. https://web.cs.ucdavis.edu/~rogaway/papers/subset.pdf

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygfc-0.2.1.tar.gz (44.4 kB view hashes)

Uploaded Source

Built Distributions

pygfc-0.2.1-cp39-cp39-manylinux2014_aarch64.whl (131.5 kB view hashes)

Uploaded CPython 3.9

pygfc-0.2.1-cp39-cp39-manylinux2010_x86_64.whl (127.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pygfc-0.2.1-cp39-cp39-manylinux1_x86_64.whl (127.0 kB view hashes)

Uploaded CPython 3.9

pygfc-0.2.1-cp38-cp38-manylinux2014_aarch64.whl (130.5 kB view hashes)

Uploaded CPython 3.8

pygfc-0.2.1-cp38-cp38-manylinux2010_x86_64.whl (127.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pygfc-0.2.1-cp38-cp38-manylinux1_x86_64.whl (127.2 kB view hashes)

Uploaded CPython 3.8

pygfc-0.2.1-cp37-cp37m-manylinux2010_x86_64.whl (117.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pygfc-0.2.1-cp37-cp37m-manylinux1_x86_64.whl (117.2 kB view hashes)

Uploaded CPython 3.7m

pygfc-0.2.1-cp36-cp36m-manylinux2010_x86_64.whl (118.3 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

pygfc-0.2.1-cp36-cp36m-manylinux1_x86_64.whl (118.3 kB view hashes)

Uploaded CPython 3.6m

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page