TextHidden

Struct TextHidden 

Source
pub struct TextHidden<C: Cipher, P: Pose> { /* private fields */ }

Implementations§

Source§

impl<C: Cipher, P: Pose> TextHidden<C, P>

Source

pub fn new(cipher: C, pose: P, ch1: char, ch2: char) -> Self

Examples found in repository?
examples/demo.rs (line 8)
3fn main() {
4    //加密方法
5    let cipher = NoCipher;
6    //文本水印摆放位置
7    let pose = SimplePose::default();
8    let text_hidden = TextHidden::new(cipher, pose, '\u{200B}', '\u{200C}');
9    let th = text_hidden.text_hidden("hello", "key");
10    println!("加密后:{}长度:{}!", th,th.len());
11    let result = text_hidden.text_recover(th.as_str());
12    let result_str = result.unwrap();
13    println!("解密后:{}长度:{}", result_str, result_str.len());
14}
Source

pub fn text_hidden(&self, text: &str, key: &str) -> String

隐藏文本 text显示文本 和 key隐写文字,返回隐藏后的文本

Examples found in repository?
examples/demo.rs (line 9)
3fn main() {
4    //加密方法
5    let cipher = NoCipher;
6    //文本水印摆放位置
7    let pose = SimplePose::default();
8    let text_hidden = TextHidden::new(cipher, pose, '\u{200B}', '\u{200C}');
9    let th = text_hidden.text_hidden("hello", "key");
10    println!("加密后:{}长度:{}!", th,th.len());
11    let result = text_hidden.text_recover(th.as_str());
12    let result_str = result.unwrap();
13    println!("解密后:{}长度:{}", result_str, result_str.len());
14}
Source

pub fn text_recover(&self, text: &str) -> Result<String, &'static str>

Examples found in repository?
examples/demo.rs (line 11)
3fn main() {
4    //加密方法
5    let cipher = NoCipher;
6    //文本水印摆放位置
7    let pose = SimplePose::default();
8    let text_hidden = TextHidden::new(cipher, pose, '\u{200B}', '\u{200C}');
9    let th = text_hidden.text_hidden("hello", "key");
10    println!("加密后:{}长度:{}!", th,th.len());
11    let result = text_hidden.text_recover(th.as_str());
12    let result_str = result.unwrap();
13    println!("解密后:{}长度:{}", result_str, result_str.len());
14}

Trait Implementations§

Source§

impl Default for TextHidden<XorCipher, SimplePose>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C, P> Freeze for TextHidden<C, P>
where C: Freeze, P: Freeze,

§

impl<C, P> RefUnwindSafe for TextHidden<C, P>

§

impl<C, P> Send for TextHidden<C, P>
where C: Send, P: Send,

§

impl<C, P> Sync for TextHidden<C, P>
where C: Sync, P: Sync,

§

impl<C, P> Unpin for TextHidden<C, P>
where C: Unpin, P: Unpin,

§

impl<C, P> UnwindSafe for TextHidden<C, P>
where C: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.