pub fn hex_encode_mixed(input: &str) -> StringExpand description
Encodes text with mixed hexadecimal formats (0x, \x, %, &#x).
Randomly encodes each byte using one of four hex formats: C-style escape
(\x), URL encoding (%), hex literal (0x), or HTML entity (&#x;).
This format mixing can evade detection systems that pattern-match specific
encoding styles.
§Use Cases
- Red Team: Bypass detection with varied encoding formats
- XSS/SQLi Testing: Evade filters that only recognize one format
- Blue Team: Test encoder/decoder robustness across formats
§Examples
use redstr::hex_encode_mixed;
let result = hex_encode_mixed("AB");
// Example output: "\x41%42" or "0x41B" (varies each run)
assert!(result.len() >= 2);
// Mixed format payload obfuscation
let payload = hex_encode_mixed("<script>");
// Example: "\x3c%73c0x72\x69%70t\x3e"