Add tick marks around code items in docs

This commit is contained in:
Henry de Valence 2017-04-02 23:12:18 +02:00
parent a89177f80e
commit 73e172484c
3 changed files with 26 additions and 24 deletions

View file

@ -70,7 +70,7 @@ pub const SQRT_M1: FieldElement = FieldElement([
pub const SQRT_M1: FieldElement = FieldElement([1718705420411056, 234908883556509, 2233514472574048, 2117202627021982, 765476049583133]); pub const SQRT_M1: FieldElement = FieldElement([1718705420411056, 234908883556509, 2233514472574048, 2117202627021982, 765476049583133]);
/// Precomputed value of the other square root of -1 (mod p), /// Precomputed value of the other square root of -1 (mod p),
/// i.e., MSQRT_M1 = -SQRT_M1. /// i.e., `MSQRT_M1 = -SQRT_M1`.
#[cfg(not(feature="radix_51"))] #[cfg(not(feature="radix_51"))]
pub const MSQRT_M1: FieldElement = FieldElement([ pub const MSQRT_M1: FieldElement = FieldElement([
32595792, 7943725, -9377950, -3500415, -12389472, 32595792, 7943725, -9377950, -3500415, -12389472,
@ -92,7 +92,7 @@ pub const A: FieldElement = FieldElement([
#[cfg(feature="radix_51")] #[cfg(feature="radix_51")]
pub const A: FieldElement = FieldElement([486662, 0, 0, 0, 0]); pub const A: FieldElement = FieldElement([486662, 0, 0, 0, 0]);
/// SQRT_MINUS_A is sqrt(-486662) /// `SQRT_MINUS_A` is sqrt(-486662)
// XXX I think that this was used in Adam's code for his elligator // XXX I think that this was used in Adam's code for his elligator
// implementation, but that should maybe be using sqrt(-486664) // implementation, but that should maybe be using sqrt(-486664)
// instead...? - hdevalence // instead...? - hdevalence
@ -103,7 +103,7 @@ pub const SQRT_MINUS_A: FieldElement = FieldElement([ // sqrtMinusA
#[cfg(feature="radix_51")] #[cfg(feature="radix_51")]
pub const SQRT_MINUS_A: FieldElement = FieldElement([557817479725543, 1643290402203250, 16226468853936, 1304118542701054, 1985241807451647]); pub const SQRT_MINUS_A: FieldElement = FieldElement([557817479725543, 1643290402203250, 16226468853936, 1304118542701054, 1985241807451647]);
/// SQRT_MINUS_APLUS2 is sqrt(-486664) /// `SQRT_MINUS_APLUS2` is sqrt(-486664)
#[cfg(not(feature="radix_51"))] #[cfg(not(feature="radix_51"))]
pub const SQRT_MINUS_APLUS2: FieldElement = FieldElement([ pub const SQRT_MINUS_APLUS2: FieldElement = FieldElement([
-12222970, -8312128, -11511410, 9067497, -15300785, -12222970, -8312128, -11511410, 9067497, -15300785,
@ -111,7 +111,7 @@ pub const SQRT_MINUS_APLUS2: FieldElement = FieldElement([
#[cfg(feature="radix_51")] #[cfg(feature="radix_51")]
pub const SQRT_MINUS_APLUS2: FieldElement = FieldElement([1693982333959686, 608509411481997, 2235573344831311, 947681270984193, 266558006233600]); pub const SQRT_MINUS_APLUS2: FieldElement = FieldElement([1693982333959686, 608509411481997, 2235573344831311, 947681270984193, 266558006233600]);
/// SQRT_MINUS_HALF is sqrt(-1/2) /// `SQRT_MINUS_HALF` is sqrt(-1/2)
#[cfg(not(feature="radix_51"))] #[cfg(not(feature="radix_51"))]
pub const SQRT_MINUS_HALF: FieldElement = FieldElement([ // sqrtMinusHalf pub const SQRT_MINUS_HALF: FieldElement = FieldElement([ // sqrtMinusHalf
-17256545, 3971863, 28865457, -1750208, 27359696, -17256545, 3971863, 28865457, -1750208, 27359696,
@ -119,7 +119,7 @@ pub const SQRT_MINUS_HALF: FieldElement = FieldElement([ // sqrtMinusHalf
#[cfg(feature="radix_51")] #[cfg(feature="radix_51")]
pub const SQRT_MINUS_HALF: FieldElement = FieldElement([266547196637087, 2134345371906993, 1135042577398223, 67298593331632, 743161882051057]); pub const SQRT_MINUS_HALF: FieldElement = FieldElement([266547196637087, 2134345371906993, 1135042577398223, 67298593331632, 743161882051057]);
/// HALF_Q_MINUS_1_BYTES is (2^255-20)/2 expressed in little endian form. /// `HALF_Q_MINUS_1_BYTES` is (2^255-20)/2 expressed in little endian form.
pub const HALF_Q_MINUS_1_BYTES: [u8; 32] = [ // halfQMinus1Bytes pub const HALF_Q_MINUS_1_BYTES: [u8; 32] = [ // halfQMinus1Bytes
0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,

View file

@ -59,15 +59,15 @@
//! implementation for [Ed25519](https://ed25519.cr.yp.to/ed25519-20110926.pdf), //! implementation for [Ed25519](https://ed25519.cr.yp.to/ed25519-20110926.pdf),
//! we use several different models for curve points: //! we use several different models for curve points:
//! //!
//! * CompletedPoint: points in 𝗣^1 x 𝗣^1; //! * `CompletedPoint`: points in 𝗣^1 x 𝗣^1;
//! * ExtendedPoint: points in 𝗣^3; //! * `ExtendedPoint`: points in 𝗣^3;
//! * ProjectivePoint: points in 𝗣^2. //! * `ProjectivePoint`: points in 𝗣^2.
//! //!
//! Finally, to accelerate additions, we use two cached point formats, //! Finally, to accelerate additions, we use two cached point formats,
//! one for the affine model and one for the 𝗣^3 model: //! one for the affine model and one for the 𝗣^3 model:
//! //!
//! * AffineNielsPoint: `(y+x, y-x, 2dxy)` //! * `AffineNielsPoint`: `(y+x, y-x, 2dxy)`
//! * ProjectiveNielsPoint: `(Y+X, Y-X, Z, 2dXY)` //! * `ProjectiveNielsPoint`: `(Y+X, Y-X, Z, 2dXY)`
//! //!
//! [1]: https://moderncrypto.org/mail-archive/curves/2016/000807.html //! [1]: https://moderncrypto.org/mail-archive/curves/2016/000807.html
@ -103,7 +103,7 @@ use std::boxed::Box;
/// determined by the `y`-coordinate and the sign of `x`, marshalled /// determined by the `y`-coordinate and the sign of `x`, marshalled
/// into a 32-byte array. /// into a 32-byte array.
/// ///
/// The first 255 bits of a CompressedEdwardsY represent the /// The first 255 bits of a `CompressedEdwardsY` represent the
/// y-coordinate. The high bit of the 32nd byte gives the sign of `x`. /// y-coordinate. The high bit of the 32nd byte gives the sign of `x`.
#[derive(Copy, Clone, Eq, PartialEq)] #[derive(Copy, Clone, Eq, PartialEq)]
pub struct CompressedEdwardsY(pub [u8; 32]); pub struct CompressedEdwardsY(pub [u8; 32]);
@ -303,7 +303,7 @@ pub struct ProjectivePoint {
Z: FieldElement, Z: FieldElement,
} }
/// A CompletedPoint is a point ((X:Z), (Y:T)) in 𝗣¹(𝔽ₚ)×𝗣¹(𝔽ₚ). /// A `CompletedPoint` is a point ((X:Z), (Y:T)) in 𝗣¹(𝔽ₚ)×𝗣¹(𝔽ₚ).
/// A point (x,y) in the affine model corresponds to ((x:1),(y:1)). /// A point (x,y) in the affine model corresponds to ((x:1),(y:1)).
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct CompletedPoint { pub struct CompletedPoint {

View file

@ -41,25 +41,27 @@ use constants;
#[cfg(feature="radix_51")] #[cfg(feature="radix_51")]
pub type Limb = u64; pub type Limb = u64;
/// FieldElement represents an element of the field GF(2^255 - 19). An element /// A `FieldElement` represents an element of the field GF(2^255 - 19).
/// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77 ///
/// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on /// With the `radix_51` feature, a `FieldElement` is represented in
/// context. /// radix 2^51 as five `u64`s; the coefficients are allowed to grow up
/// to 2^54 between reductions mod `p`.
#[cfg(feature="radix_51")] #[cfg(feature="radix_51")]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct FieldElement(pub [u64; 5]); pub struct FieldElement(pub [u64; 5]);
/// FieldElements are represented as an array of ten "Limbs", which are radix /// Without the `radix51` feature enabled, `FieldElements` are represented
/// 25.5, that is, each Limb of a FieldElement alternates between being /// in radix 2^25.5 as ten `i32`s.
/// represented as a factor of 2^25 or 2^26 more than the last corresponding
/// integer.
#[cfg(not(feature="radix_51"))] #[cfg(not(feature="radix_51"))]
pub type Limb = i32; pub type Limb = i32;
/// FieldElement represents an element of the field GF(2^255 - 19). An element /// A `FieldElement` represents an element of the field GF(2^255 - 19).
/// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77 ///
/// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on /// With the `radix_51` feature, a `FieldElement` is represented in
/// context. /// radix 2^25.5 as ten `i32`s, so that an element t, entries
/// t[0],...,t[9], represents the integer t[0]+2^26 t[1]+2^51
/// t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i]
/// vary depending on context.
#[cfg(not(feature="radix_51"))] #[cfg(not(feature="radix_51"))]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct FieldElement(pub [i32; 10]); pub struct FieldElement(pub [i32; 10]);