In this repository you will find the implementation of the
McEliece cryptosystem
using the common (7,4,3) Hamming codes
combination as a static library. Please note that this code is for demonstration purposes
only and not for other use.
Note
This code is not recommended for use in document or text encryption of relevance, since, among many reasons, Hamming codes are not the best option to implement in the McEliece criptosistem. For example, Goppa or Reed Solomon codes offer greater complexity and therefore greater security.
In this new version, the cryptosystem matrices are stored as arrays of 8-bit blocks, each representing
a row of up to 8 bits. Since matrices S=(4×4), P=(7×7), and G=(4×7) don’t use all 8 bits,
only the most significant bits are used, with the MSB
as the first position. The previous version v1.0.0
stored each bit separately, wasting space and reducing access efficiency.
First of all, after cloning this project's repository, you need to initialize the git submodules, which in this case are the dependencies check 0.15.2 (for tests) and libsodium 1.0.20 (for RNG).
git clone https://github.com/filipondios/mceliece
git submodule update --init --recursiveThe CMakePresets.json file supports building for x64 and x86 architectures, in any mode debug or release for
Linux and Windows. The compilation process is very simple: first you must choose a preset and the compile that preset.
These are some examples:
# Compile the project for x64 linux release mode
cmake --preset x64-release-linux
cmake --build --preset x64-release-linux
# Compile the project for x86 windows debug mode
cmake --preset x86-debug-windows
cmake --build --preset x86-debug-windowsImportant
After running build commands (either in Windows or Linux) with a preset <preset>, you should
find the application static library file at out/build/<preset>/ and the tests executable file at
out/build/<preset>/tests/. The application binary must be named libmceliece.a (Linux) or libmceliece.lib
(Windows) and the tests binary mceliece_tests.