lib.rs 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2018, The Tor Project, Inc.
  2. // Copyright (c) 2018, isis agora lovecruft
  3. // See LICENSE for licensing information
  4. //! Common cryptographic functions and utilities.
  5. //!
  6. //! # Hash Digests and eXtendable Output Functions (XOFs)
  7. //!
  8. //! The `digests` module contains submodules for specific hash digests
  9. //! and extendable output functions.
  10. //!
  11. //! ```
  12. //! use crypto::digests::sha256::Sha256;
  13. //!
  14. //! let hasher: Sha256 = Sha256::default();
  15. //! let mut result: [u8; 32] = [0u8; 32];
  16. //!
  17. //! hasher.input("foo");
  18. //! hasher.input("bar");
  19. //! hasher.input("baz");
  20. //!
  21. //! result.copy_from_slice(hasher.result().as_bytes());
  22. //!
  23. //! assert!(result == "XXX");
  24. //! ```
  25. #[deny(missing_docs)]
  26. // External crates from cargo or TOR_RUST_DEPENDENCIES.
  27. extern crate digest;
  28. extern crate libc;
  29. // Our local crates.
  30. extern crate external;
  31. mod digests; // Unfortunately named "digests" plural to avoid name conflict with the digest crate