1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Hazardous materials (a.k.a. "hazmat"): low-level primitives.
//!
//! <div class="warning">
//! <b>Security️ Warning</b>
//!
//! YOU PROBABLY DON'T WANT TO USE THESE!
//!
//! If you are an end user / non-expert in cryptography, do not use these!
//! Failure to use them correctly can lead to catastrophic failures.
//! </div>
use crate::;
use PrimeField;
use CtOption;
/// Access to a curve's base field element type.
///
/// This trait is bounded on [`CurveArithmetic`] to provide a complete arithmetic implementation,
/// and also make the associated `FieldElement` type completely inaccessible unless this trait
/// is in scope, having been imported from this `hazmat` module so that text appears in the import.
/// We also explicitly recommend against re-exporting it so the `hazmat` keyword is easy to
/// search for.
///
/// <div class="warning">
/// <b>Security Warning</b>
///
/// Field elements are easily misused, unlike group-based abstractions. Some elliptic curves utilize
/// lazy normalization, meaning that field elements may be non-canonical leading to miscomputations.
/// We strongly recommend you avoid using this trait except for use cases that are truly dependent
/// on coordinates, such as curve point encodings or hash2curve.
/// </div>