Crate zw

source · []
Expand description

ZW

Utility for encoding and decoding text using zero-width characters.

How it works

Subject text is first converted to its binary representation (e.g. “foo” -> “011001100110111101101111”), then each digit is replaced with a zero-width character (specifically: U+200B and U+200C). Decoding is simply the inverse of the same flow of operations.

Example usage

use zw;
let encoded = zw::encode("Hello");
let decoded = zw::decode(&encoded);
assert_ne!("Hello", &encoded);
assert_eq!("Hello", &decoded);

Constants

Zero-width character to exchange with “0”

Zero-width character to exchange with “1”

Functions

Decodes a zero-width character encoded string, returning a new one

Encodes a string, returning a new one containing only zero-width characters