dlog-group

Crates.iodlog-group
lib.rsdlog-group
version0.1.0
created_at2025-10-28 08:47:28.017557+00
updated_at2025-10-28 08:47:28.017557+00
descriptionUnified 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
repositoryhttps://github.com/aleph-fbk/pet-crypto-primitives-rs
max_upload_size
id1904382
size75,480
Mario Scuro (mscuro-fbk)

documentation

https://aleph.fbk.eu/pet-crypto-primitives-rs/dlog-group/supported.html

README

dlog-group

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.

Supported groups

Currently supports the following Elliptic-Curve Groups: ristretto used by default, p256, k256 and p384 enabled by features.

Installation

[dependencies]
dlog-groups = "0.1"           # replace with the latest version

# Optional features:
# dlog-groups = { version = "0.1", features = ["p256", "k256", "p384"] }

Example

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);

License

Licensed under either of Apache License Version 2.0, or MIT license.

Acknowledgments

This work has been supported by the joint laboratory between the Bruno Kessler Foundation (FBK) and the Italian Government Printing Office and Mint (IPZS).

Commit count: 0

cargo fmt