doc: Add unit test for xor_into

This commit is contained in:
Benjamin Lipp
2023-11-15 14:32:19 +01:00
parent 27746781c0
commit 0051cbd48e
+11
View File
@@ -15,6 +15,17 @@ use std::{
use crate::coloring::{Public, Secret};
/// Xors a and b element-wise and writes the result into a.
///
/// # Examples
///
/// ```
/// use rosenpass::util::xor_into;
/// let mut a = String::from("hello").into_bytes();
/// let b = b"world";
/// xor_into(&mut a, b);
/// assert_eq!(&a, b"\x1f\n\x1e\x00\x0b");
/// ```
#[inline]
pub fn xor_into(a: &mut [u8], b: &[u8]) {
assert!(a.len() == b.len());