Skip to content

Commit

Permalink
README: Fix chained example wrt digest v0.10 (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag authored Dec 14, 2021
1 parent e1c2240 commit c58f88a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ println!("Result: {:x}", hash);

In this example `hash` has type `GenericArray<u8, U32>`, which is a generic alternative to `[u8; 32]` defined in the [`generic-array`] crate.

Alternatively, you can use chained approach, which is equivalent to the previous example:
Alternatively, you can use a chained approach, which is equivalent to the previous example:

```rust
use sha2::{Sha256, Digest};

let hash = Sha256::new()
.chain(b"Hello world!")
.chain("String data")
.chain_update(b"Hello world!")
.chain_update("String data")
.finalize();
println!("Result: {:x}", hash);
```
Expand Down

0 comments on commit c58f88a

Please sign in to comment.