Skip to content

Commit

Permalink
wf
Browse files Browse the repository at this point in the history
  • Loading branch information
eschorn1 committed Oct 30, 2023
1 parent 17ee437 commit 9ba1a9c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- 1.72.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
#- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.1.1 (2023-10-30)

- Fully functional in all three parameter sets

## 0.1.0 (2023-10-15)

- Initial release
- Initial API release skeleton
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ml-kem-rs"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "FIPS 203 (draft): Module-Lattice-Based Key-Encapsulation Mechanism"
Expand All @@ -17,7 +17,6 @@ exclude = [".idea/*"]
zeroize = { version = "1.6.0", features = ["zeroize_derive"] }
sha3 = "0.10.8"
rand = "0.8.5"
getrandom = { version = "0.2", features = ["js"] }


[features]
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,39 @@

[mlKem] Module-Lattice-Based Key-Encapsulation Mechanism Standard written in pure Rust.

Very simple to use, per the following example.
This library implements the FIPS 203 **draft** standard in pure Rust.
All three security parameters sets are fully functional. The code
does not require the standard library, e.g. `#[no_std]`, and has
no heap allocations so will be suitable for WASM and embedded applications.
Significant performance optimizations will be forthcoming.

See: <https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.ipd.pdf>

The functionality is very simple to use, per the following example.

~~~rust
// Use the desired target parameter set
use ml_kem_rs::ml_kem_512; // Could also be ml_kem_1024 or ml_kem_768

// Alice runs KeyGen, and then serializes ek for Bob (to bytes)
// Alice runs KeyGen, and then serializes the encaps key ek for Bob (to bytes)
let (alice_ek, alice_dk) = ml_kem_512::key_gen();
let alice_ek_bytes = alice_ek.to_bytes();

// Alice sends ek bytes to Bob
// Alice sends the encaps key ek_bytes to Bob
let bob_ek_bytes = alice_ek_bytes;

// Bob deserializes ek bytes, runs Encaps, to get ssk and serializes ct for Alice (to bytes)
// Bob deserializes the encaps ek_bytes, runs Encaps, to get the shared secret
// and ciphertext ct. He serializes the ciphertext ct for Alice (to bytes)
let bob_ek = ml_kem_512::new_ek(bob_ek_bytes);
let (bob_ssk_bytes, bob_ct) = bob_ek.encaps();
let bob_ct_bytes = bob_ct.to_bytes();

// Bob sends ct bytes to Alice
// Bob sends the ciphertext ct_bytes to Alice
let alice_ct_bytes = bob_ct_bytes;

// Alice deserializes runs Decaps
// Alice deserializes the ciphertext_ct and runs Decaps with decaps key
let alice_ct = ml_kem_512::new_ct(alice_ct_bytes);
let alice_ssk_bytes = alice_dk.decaps(&alice_ct);
let alice_ssk_bytes = alice_dk.decaps( & alice_ct);

// Alice and Bob will now have the same secret key
assert_eq!(bob_ssk_bytes, alice_ssk_bytes);
Expand Down Expand Up @@ -88,9 +97,9 @@ dual licensed as above, without any additional terms or conditions.

[docs-link]: https://docs.rs/ml-kem-rs/

[build-image]: https://github.com/integritychain/ml-kem-rs/workflows/ml-kem-rs/badge.svg?branch=master&event=push
[build-image]: https://github.com/integritychain/ml-kem-rs/workflows/integration/badge.svg?branch=master&event=push

[build-link]: https://github.com/integritychain/ml-kem-rs/actions?query=workflow%3Aml-kem-rs
[build-link]: https://github.com/integritychain/ml-kem-rs/actions?query=workflow%3Aintegration

[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// TODO
// 3. Implement bench
// 4. Fix github actions
// 5. Review main Doc
// 5. Review main Doc; features: no_std, no alloc, minimal dependencies, CT
// 6. Git push to CC, publish as 0.1.1
// 7. Re-read spec
#[cfg(test)]
Expand Down

0 comments on commit 9ba1a9c

Please sign in to comment.