1 #![allow(clippy::many_single_char_names)]
2 #![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
3 #![doc = include_str!("../README.md")]
6 //! Add `srp` dependency to your `Cargo.toml`:
13 //! Next read documentation for [`client`](client/index.html) and
14 //! [`server`](server/index.html) modules.
16 //! # Algorithm description
17 //! Here we briefly describe implemented algorithm. For additional information
18 //! refer to SRP literature. All arithmetic is done modulo `N`, where `N` is a
19 //! large safe prime (`N = 2q+1`, where `q` is prime). Additionally `g` MUST be
20 //! a generator modulo `N`. It's STRONGLY recommended to use SRP parameters
21 //! provided by this crate in the [`groups`](groups/index.html) module.
23 //! | Client | Data transfer | Server |
24 //! |------------------------|-------------------|---------------------------------|
25 //! |`a_pub = g^a` | — `a_pub`, `I` —> | (lookup `s`, `v` for given `I`) |
26 //! |`x = PH(P, s)` | <— `b_pub`, `s` — | `b_pub = k*v + g^b` |
27 //! |`u = H(a_pub ‖ b_pub)` | | `u = H(a_pub ‖ b_pub)` |
28 //! |`s = (b_pub - k*g^x)^(a+u*x)` | | `S = (b_pub - k*g^x)^(a+u*x)` |
29 //! |`K = H(s)` | | `K = H(s)` |
30 //! |`M1 = H(A ‖ B ‖ K)` | — `M1` —> | (verify `M1`) |
31 //! |(verify `M2`) | <— `M2` — | `M2 = H(A ‖ M1 ‖ K)` |
33 //! Variables and notations have the following meaning:
35 //! - `I` — user identity (username)
36 //! - `P` — user password
37 //! - `H` — one-way hash function
38 //! - `PH` — password hashing algroithm, in the RFC 5054 described as
39 //! `H(s ‖ H(I ‖ ":" ‖ P))`
40 //! - `^` — (modular) exponentiation
41 //! - `‖` — concatenation
42 //! - `x` — user private key
43 //! - `s` — salt generated by user and stored on the server
44 //! - `v` — password verifier equal to `g^x` and stored on the server
45 //! - `a`, `b` — secret ephemeral values (at least 256 bits in length)
46 //! - `A`, `B` — Public ephemeral values
47 //! - `u` — scrambling parameter
48 //! - `k` — multiplier parameter (`k = H(N || g)` in SRP-6a)
50 //! [1]: https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol
51 //! [2]: https://tools.ietf.org/html/rfc5054