| Crates.io | dlog-group |
| lib.rs | dlog-group |
| version | 0.1.0 |
| created_at | 2025-10-28 08:47:28.017557+00 |
| updated_at | 2025-10-28 08:47:28.017557+00 |
| description | Unified wrapper around different prime-order cryptographic groups where the discrete log, computational Diffie–Hellman, and decisional Diffie–Hellman problems are believed to be hard. |
| homepage | |
| repository | https://github.com/aleph-fbk/pet-crypto-primitives-rs |
| max_upload_size | |
| id | 1904382 |
| size | 75,480 |
A unified wrapper around different prime-order cryptographic groups where the discrete log (DL), computational Diffie–Hellman (CDH), and decisional Diffie–Hellman (DDH) problems are believed to be hard.
This crate provides a common trait-based interface over popular RustCrypto elliptic-curve crates, plus Ristretto.
Currently supports the following Elliptic-Curve Groups:
ristretto used by default, p256, k256 and p384 enabled by features.
[dependencies]
dlog-groups = "0.1" # replace with the latest version
# Optional features:
# dlog-groups = { version = "0.1", features = ["p256", "k256", "p384"] }
Import the ristretto backend and the Trait specifications
use dlog_group::{
ristretto::{RistrettoGroup},
group::{GroupPoint, GroupScalar}
};
use rand;
Generete an rng for a random scalar r
let mut rng = rand::thread_rng();
Do the following simple check $g = \dfrac{g^{1 + r}}{g^r}$
let group_generator = RistrettoGroup::generator();
let r = RistrettoGroup::scalar_random(&mut rng);
let group_pow = group_generator * &r;
let group_mul = group_generator + &group_pow;
let group_div = group_mul - &group_pow;
assert_eq!(group_div, group_generator);
Licensed under either of Apache License Version 2.0, or MIT license.
This work has been supported by the joint laboratory between the Bruno Kessler Foundation (FBK) and the Italian Government Printing Office and Mint (IPZS).