]>
git.proxmox.com Git - rustc.git/blob - vendor/orion/src/lib.rs
3 // Copyright (c) 2018-2022 The orion Developers
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 //! A usable pure-Rust cryptography library.
25 //! ## Authenticated secret-key encryption
26 //! [`orion::aead`] offers authenticated secret-key encryption using
27 //! XChaCha20Poly1305.
29 //! ## Password hashing and verification
30 //! [`orion::pwhash`] offers password hashing and verification using Argon2i.
33 //! [`orion::kdf`] offers key derivation using Argon2i.
35 //! ## Message authentication
36 //! [`orion::auth`] offers message authentication and verification using BLAKE2b.
39 //! [`orion::hash`] offers hashing using BLAKE2b.
42 //! [`orion::kex`] offers ephemeral key exchange using X25519 and BLAKE2b.
44 //! ### A note on `no_std`:
45 //! When Orion is used in a `no_std` context, the high-level API is not available, since it relies on access to the systems random number generator.
47 //! More information about Orion is available in the [wiki].
49 //! [`orion::aead`]: crate::aead
50 //! [`orion::pwhash`]: crate::pwhash
51 //! [`orion::kdf`]: crate::kdf
52 //! [`orion::auth`]: crate::auth
53 //! [`orion::hash`]: crate::hash
54 //! [`orion::kex`]: crate::kex
55 //! [wiki]: https://github.com/orion-rs/orion/wiki
57 #![cfg_attr(not(feature = "safe_api"), no_std)]
58 #![forbid(unsafe_code)]
59 #![deny(clippy::mem_forget)]
64 unused_qualifications
,
67 #![doc(html_root_url = "https://docs.rs/orion/0.17.3")]
68 #![cfg_attr(docsrs, feature(doc_cfg))]
71 #[cfg(feature = "safe_api")]
72 extern crate quickcheck
;
74 #[cfg(feature = "safe_api")]
75 #[macro_use(quickcheck)]
76 extern crate quickcheck_macros
;
78 #[cfg(feature = "alloc")]
79 #[cfg_attr(feature = "alloc", macro_use)]
86 /// Utilities such as constant-time comparison.
89 /// Errors for Orion's cryptographic operations.
92 /// \[__**Caution**__\] Low-level API.
95 #[cfg(feature = "safe_api")]
98 #[cfg(feature = "safe_api")]
99 pub use high_level
::hash
;
101 #[cfg(feature = "safe_api")]
102 pub use high_level
::aead
;
104 #[cfg(feature = "safe_api")]
105 pub use high_level
::auth
;
107 #[cfg(feature = "safe_api")]
108 pub use high_level
::pwhash
;
110 #[cfg(feature = "safe_api")]
111 pub use high_level
::kdf
;
113 #[cfg(feature = "safe_api")]
114 pub use high_level
::kex
;
117 /// Testing framework.
118 pub mod test_framework
;