1 unstable release
new 0.0.1 | Dec 19, 2024 |
---|
#216 in #messaging
87 downloads per month
25KB
214 lines
This crate is my way of showing my appreciation for the work of Timothy C. May. The repo is still a work in progress, there's lots of exciting work to be done.
-CryptoPatrick
Date: Wed, 10 Feb 93 11:55:45 -0800 Cypherpunks,
I want to share with you folks some preliminary ideas on "timed-release cryptographic protocols," that is, methods for sending encrypted messages into the future.
-Tim May
lib.rs
:
AES-GCM Authenticated Encryption
AES (Advanced Encryption Standard) is a widely used encryption algorithm for securing data. AES has several operator modes, of which we have selected GCM (Galois/Counter Mode). GCM combines encryption with authentication. This ensures that the data is confidential, but also mechanisms to verify that the data hasn’t been tampered with.
Large Numbers
Working with large cryptographically secure numbers in Rust involves using crates that provide efficient, secure, and accurate arithmetic for numbers far beyond the size of standard primitive data types like u64 or u128. This is essential in cryptographic contexts where numbers can be hundreds or even thousands of bits long.
Rust does not provide these capabilities natively for large numbers, so we
are going to use the crates; num-bigint
and rug
.
num-bigint is beginner-friendly and well-documented.
We will lean heavily on Biguint
crate to handle common cryptography primitives
and modular operations, such as:
- large prime numbers : secure generation of large primes
- modular arithmetic : a mod n in order to ensure that comps stay inside n
- modular exponentiation : a^b mod n
- modulo inverse : computing (x^-1 mod n)
Notes on the use of S, modular exponentiation by squaring
Computing x^2 mod p
is generally assumed (TODO: citation needed) to be a
single operation that takes constant time. For example, one could just look
up the multiplication table, which has only p^2 entries and can be precomputed.
For further elaborations on this important topic:
- https://en.m.wikipedia.org/wiki/Exponentiation_by_squaring
- https://math.stackexchange.com/questions/2944032/ why-is-the-algorithm-for-modular-exponentiation-by-squaring-considered-as-poly-t
Primality Testing
... TODO: Elaborate on the use of rug.
We use the rug
crate to perform primatlity testing.
References:
[1] R. L. Rivest, A. Shamir, and D. A. Wagner. 1996. Time-lock Puzzles and Timed-release Crypto. Technical Report. Cambridge, MA, USA.
[2] Timothy C. May. Timed-release crypto, February 1993. https://cypherpunks.venona.com/date/1993/02/msg00306.html and https://cypherpunks.venona.com/date/1993/02/msg00129.html
Dependencies
~2MB
~37K SLoC