From 1d8e2dd071d7e35cb26951bc0ad0d6ebb760f495 Mon Sep 17 00:00:00 2001 From: skaunov <65976143+skaunov@users.noreply.github.com> Date: Tue, 27 Sep 2022 22:27:09 +0300 Subject: [PATCH] Details `seek()` usage It took some effort to understand that counter works not by blocks as in [diagram] (from Wikipedia?) but counts each bytes, so I would say it worth mentioning this. Please, comment if it's better to place this notification upstream to `cipher` crate, or any other place. [diagram]: https://raw.githubusercontent.com/RustCrypto/media/26acc39f/img/block-modes/ctr_enc.svg --- ctr/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctr/src/lib.rs b/ctr/src/lib.rs index 5b2d878..1199dbc 100644 --- a/ctr/src/lib.rs +++ b/ctr/src/lib.rs @@ -37,7 +37,7 @@ //! } //! assert_eq!(buf[..], plaintext[..]); //! -//! // CTR mode supports seeking +//! // CTR mode supports seeking. The parameter is zero-based _bytes_ counter (not _blocks_). //! cipher.seek(0u32); //! //! // encrypt/decrypt from buffer to buffer