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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
// License: see LICENSE file at root directory of `master` branch //! # Dia-Hammer //! //! ## Project //! //! - Repository: <https://bitbucket.org/haibison/hammer> //! - License: Nice License 1.0.0 _(see LICENSE file at root directory of `master` branch)_ //! - _This project follows [Semantic Versioning 2.0.0]_ //! //! ## Features //! //! - This program helps hash data from either an input string, stdin, or file(s). //! - Supported algorithms: keccak-224, keccak-256, keccak-384, keccak-512, sha3-224, sha3-256, sha3-384, sha3-512, shake-128, shake-256. //! //! ## Building from source or installing via Cargo //! //! This crate is intended to be used as a program. So default features just contain some documentation, constants and no dependencies. //! //! `bin` feature contains a binary which uses some dependencies. //! //! ### Building from source: //! //! ```shell //! ~> # Clone a specific version via tag name //! ~> git clone --branch=x.y.z --depth=1 -- https://bitbucket.org/haibison/hammer hammer-x.y.z/ //! ~> cd hammer-x.y.z/ //! ~> cargo build --release --features=bin //! ``` //! //! ### Installing via Cargo: //! //! ```shell //! ~> cargo install dia-hammer --version=x.y.z --features=bin //! ``` //! //! ## Examples //! //! ```shell //! ~> # Print help //! ~> hammer help //! ... //! //! ~> # Hash an input string //! ~> hammer shake-128 haha //! 05ea9934234a88a31e67a1638a7936d7 (Shake-128) //! //! ~> # Hash multiple input files //! ~> hammer sha3-224 -- /tmp/*.json //! 6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7 [SHA3-224] /tmp/haha.json //! 1931dd1553cf52ee145747ad8c0f34906022eeb788a6aa955bbf3600 [SHA3-224] /tmp/test.json //! //! ~> # Hash data fed via stdin //! ~> cat /tmp/test.json | hammer sha3-256 //! cd424cbc9ab978b547332e3ee4f2ebfe715e9cd9144a5437982cc6e16327a0eb (SHA3-256) //! //! ~> # Hash a string and print the hash as hex-array, which is useful for programmers //! ~> hammer shake128 namaste --format=hex-array //! [0xe3, 0xcd, 0x77, 0x06, 0x27, 0x84, 0x1f, 0x8e, 0xb6, 0x0c, 0xfd, 0x3e, 0xa6, 0x93, 0x17, 0x1e] (Shake-128) //! //! ~> # On Unix, hash 64 KiB of data from /dev/urandom //! ~> hammer sha3-224 --limit=65536 -- /dev/urandom //! 3779d6c9ce150bd02ebfa7e353c85bc4934c0a16ebf736946143f121 [SHA3-224] /dev/urandom //! ``` //! //! ## References //! //! - [`tiny-keccak`][crate:tiny-keccak] //! //! [Semantic Versioning 2.0.0]: https://semver.org/spec/v2.0.0.html //! [crate:tiny-keccak]: https://crates.io/crates/tiny-keccak #![warn(missing_docs)] // ╔═════════════════╗ // ║ IDENTIFIERS ║ // ╚═════════════════╝ macro_rules! code_name { () => { "dia-hammer" }} macro_rules! version { () => { "1.4.0" }} /// # Crate name pub const NAME: &str = "Dia-Hammer"; /// # Crate code name pub const CODE_NAME: &str = code_name!(); /// # Crate version pub const VERSION: &str = version!(); /// # Crate release date (year/month/day) pub const RELEASE_DATE: (u16, u8, u8) = (2019, 8, 12); /// # Unique universally identifier of this crate pub const UUID: &str = "d38d8f87-b393-4383-bbb6-3868019b9a61"; /// # Tag, which can be used for logging... pub const TAG: &str = concat!(code_name!(), "::d38d8f87::", version!()); // ╔════════════════════╗ // ║ IMPLEMENTATION ║ // ╚════════════════════╝ pub mod version_info; #[test] fn test_crate_version() { assert_eq!(VERSION, env!("CARGO_PKG_VERSION")); }