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