Benign cargo Download

mask.rs

Rust test marker or harness
SHA-256d6908ccbaa93f1b4c7b42e074fc5f83f8a4999c14ea1736d40c893395721619a
MaleculeMd(Pa)

Evidence

English function-word token "this" lines 1–2
1//! This is code from [Tungstenite project](https://github.com/snapview/tungstenite-rs)
2#![cfg_attr(fea …
imports std::ptr::copy_nonoverlapping lines 2–7
2:24… cargo-clippy", allow(cast_ptr_alignment))]
3use std::ptr::copy_nonoverlapping;
4use std::slice;
5
6// Holds a slice guaranteed to be shorter than 8 bytes
7struct ShortSlice<'a>(&'a mut [u8]) …
English function-word token "for" lines 10–15
10:27… 'a mut [u8]) -> Self {
11 // Sanity check for debug builds
12 debug_assert!(slice.len() < 8);
13 ShortSlice(slice)
14 }
15 fn …
imports byteorder::ByteOrder lines 101–111
101:27… ce::new(buf), &mut [], ShortSlice::new(&mut [])) }
102 }
103}
104
105#[cfg(test)]
106mod tests {
107 use super::apply_mask;
108 use byteorder::{ByteOrder, LittleEndian};
109
110 /// A safe unoptimized mask application.
111 fn apply_mask_fallback(buf: &mut [u8], mask: &[u8; …
#[test] attribute lines 112–120
112:47… ate() {
113 *byte ^= mask[i & 3];
114 }
115 }
116
117 #[test]
118 fn test_apply_mask() {
119 let mask = [0x6d, 0xb6, 0xb2, 0x80];
120 let mask_u32: u32 = LittleEndian::read_u32(& …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.