Debian Codegraph @

debian/rust-vendor/shake/README.md

raw
1 # RustCrypto: SHAKE
2
3 [![crate][crate-image]][crate-link]
4 [![Docs][docs-image]][docs-link]
5 ![Apache2/MIT licensed][license-image]
6 ![Rust Version][rustc-image]
7 [![Project Chat][chat-image]][chat-link]
8 [![Build Status][build-image]][build-link]
9
10
11 Implementation of the SHAKE family of extendable-output functions (XOFs)
12 defined in [NIST FIPS 202].
13
14 ## Examples
15
16 SHAKE functions have an extendable output, so finalization methods return
17 XOF reader from which results of arbitrary length can be read.
18
19 ```rust
20 use shake::Shake128;
21 use shake::digest::{Update, ExtendableOutput, XofReader};
22 use hex_literal::hex;
23
24 let mut hasher = Shake128::default();
25 hasher.update(b"abc");
26 let mut reader = hasher.finalize_xof();
27 let mut buf = [0u8; 10];
28 reader.read(&mut buf);
29 assert_eq!(buf, hex!("5881092dd818bf5cf8a3"));
30 reader.read(&mut buf);
31 assert_eq!(buf, hex!("ddb793fbcba74097d5c5"));
32 ```
33
34 See the [`digest`] crate docs for additional examples.
35
36 ## License
37
38 The crate is licensed under either of:
39
40 * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
41 * [MIT license](http://opensource.org/licenses/MIT)
42
43 at your option.
44
45 ### Contribution
46
47 Unless you explicitly state otherwise, any contribution intentionally submitted
48 for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
49 dual licensed as above, without any additional terms or conditions.
50
51 [//]: # (badges)
52
53 [crate-image]: https://img.shields.io/crates/v/shake.svg
54 [crate-link]: https://crates.io/crates/shake
55 [docs-image]: https://docs.rs/shake/badge.svg
56 [docs-link]: https://docs.rs/shake
57 [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
58 [rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg
59 [chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
60 [chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260041-hashes
61 [build-image]: https://github.com/RustCrypto/XOFs/actions/workflows/shake.yml/badge.svg?branch=master
62 [build-link]: https://github.com/RustCrypto/XOFs/actions/workflows/shake.yml?query=branch:master
63
64 [//]: # (general links)
65
66 [NIST FIPS 202]: https://csrc.nist.gov/pubs/fips/202/final
67 [`digest`]: https://docs.rs/digest