Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: itzmeanjan/ml-kem
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0d6a3572cfd06de65d880c0094e3535dbb726bb0
Choose a base ref
..
head repository: itzmeanjan/ml-kem
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6302be22e5eb92f17b9602bdb6680f189ee023c4
Choose a head ref
46 changes: 16 additions & 30 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
@@ -20,44 +20,30 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Google Test
uses: Bacondish2023/setup-googletest@v1
with:
tag: v1.15.2

- name: Setup Google-Test
run: |
pushd ~
git clone https://github.com/google/googletest.git -b v1.16.0
pushd googletest
mkdir build
pushd build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
popd
popd
popd
- name: Build and Test (${{ matrix.compiler }}, ${{ matrix.build_type }}, ${{ matrix.test_type }})
run: |
CXX=${{ matrix.compiler }}
if [[ ${{ matrix.test_type }} == "standard" ]]; then
make test -j 2>&1 | tee build.log
make test -j
else
make ${{ matrix.build_type }}_${{ matrix.test_type }}_test -j 2>&1 | tee build.log
make ${{ matrix.build_type }}_${{ matrix.test_type }}_test -j
fi
if [ $? -ne 0 ]; then
echo "Build or Test Failed! See build.log for details."
exit 1
fi
- name: Upload Build Log
uses: actions/upload-artifact@v3
with:
name: build-log-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.test_type }}
path: build.log

- name: Run Examples
if: ${{ matrix.test_type == 'standard' && matrix.build_type == 'release' }}
run: |
CXX=${{ matrix.compiler }} make example -j 2>&1 | tee example.log
if [ $? -ne 0 ]; then
echo "Example execution Failed! See example.log for details."
exit 1
fi
- name: Upload Example Log (if failed)
if: ${{ steps.Run_Examples.outcome != 'success' && matrix.test_type == 'standard' && matrix.build_type == 'release' }}
uses: actions/upload-artifact@v3
with:
name: example-log-${{ matrix.compiler }}
path: example.log
CXX=${{ matrix.compiler }} make example -j
26 changes: 7 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -20,11 +20,11 @@ Decapsulation | Secret Key and Cipher Text | 32B Shared Secret

Here I'm maintaining `ml-kem` - a C++20 header-only fully `constexpr` library, implementing ML-KEM, supporting ML-KEM-{512, 768, 1024} parameter sets, as defined in table 2 of ML-KEM standard. It's pretty easy to use, see [usage](#usage). It shows following performance characteristics on desktop and server grade CPUs.

ML-KEM-768 Algorithm | Time taken on "12th Gen Intel(R) Core(TM) i7-1260P" | Time taken on "Raspberry Pi 4B" | Time taken on "AWS EC2 Instance c8g.large"
--- | --: | --: | --:
keygen | 23.9us | 114.3us | 35.5us
encaps | 27.7us | 133.8us | 40.4us
decaps | 30.1us | 157.6us | 45us
ML-KEM-768 Algorithm | Time taken on "12th Gen Intel(R) Core(TM) i7-1260P" | Time taken on "AWS EC2 Instance c8g.large"
--- | --: | --:
keygen | 22.3us | 31.5us
encaps | 25.6us | 35.9us
decaps | 30.1us | 43.7us

> [!NOTE]
> Find ML-KEM standard @ https://doi.org/10.6028/NIST.FIPS.203 - this is the document that I followed when implementing ML-KEM. I suggest you go through the specification to get an in-depth understanding of the scheme.
@@ -103,22 +103,10 @@ make perf -j # If you have built google-benchmark library with libPFM supp
> When benchmarking, ensure that you've disabled CPU frequency scaling, by following guide @ https://github.com/google/benchmark/blob/main/docs/reducing_variance.md.
### On 12th Gen Intel(R) Core(TM) i7-1260P

Compiled with **g++ (Ubuntu 14.2.0-4ubuntu2) 14.2.0**, while running kernel `Linux 6.8.0-41-generic x86_64`.

Benchmark results are in JSON format @ [bench_result_on_Linux_6.11.0-9-generic_x86_64_with_g++_14](./bench_result_on_Linux_6.11.0-9-generic_x86_64_with_g++_14.json).

### On ARM Cortex-A72 i.e. Raspberry Pi 4B

Compiled with **g++ (Debian 12.2.0-14) 12.2.0**, while running kernel `Linux 6.6.51+rpt-rpi-v8 aarch64`.

Benchmark results are in JSON format @ [bench_result_on_Linux_6.6.51+rpt-rpi-v8_aarch64_with_g++_12](./bench_result_on_Linux_6.6.51+rpt-rpi-v8_aarch64_with_g++_12.json).
Benchmark results are in JSON format @ [bench_result_on_Linux_6.11.0-19-generic_x86_64_with_g++_14](./bench_result_on_Linux_6.11.0-19-generic_x86_64_with_g++_14.json).

### On AWS EC2 Instance `c8g.large` i.e. AWS Graviton4

Compiled with **g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0**, while running kernel `Linux 6.8.0-1016-aws aarch64`. More about this EC2 instance @ https://aws.amazon.com/ec2/instance-types/c8g.

Benchmark results are in JSON format @ [bench_result_on_Linux_6.8.0-1016-aws_aarch64_with_g++_13](./bench_result_on_Linux_6.8.0-1016-aws_aarch64_with_g++_13.json).
Benchmark results are in JSON format @ [bench_result_on_Linux_6.8.0-1021-aws_aarch64_with_g++_13](./bench_result_on_Linux_6.8.0-1021-aws_aarch64_with_g++_13.json).

## Usage

Loading