Function encode_string

Source
pub const fn encode_string(s: &[u8]) -> EncodedString<'_>
Expand description

Encodes s such that it can be unambiguously encoded from the beginning.

ยงExample

use sha3_utils::encode_string;

let s = encode_string(b"hello, world!");
assert_eq!(
    s.iter().flatten().copied().collect::<Vec<_>>(),
    &[
        1, 104,
        104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33,
    ],
);