pub struct TextHidden<C: Cipher, P: Pose> { /* private fields */ }Implementations§
Source§impl<C: Cipher, P: Pose> TextHidden<C, P>
impl<C: Cipher, P: Pose> TextHidden<C, P>
Sourcepub fn new(cipher: C, pose: P, ch1: char, ch2: char) -> Self
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}隐藏文本 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}Sourcepub fn text_recover(&self, text: &str) -> Result<String, &'static str>
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>
impl Default for TextHidden<XorCipher, SimplePose>
Auto Trait Implementations§
impl<C, P> Freeze for TextHidden<C, P>
impl<C, P> RefUnwindSafe for TextHidden<C, P>where
C: RefUnwindSafe,
P: RefUnwindSafe,
impl<C, P> Send for TextHidden<C, P>
impl<C, P> Sync for TextHidden<C, P>
impl<C, P> Unpin for TextHidden<C, P>
impl<C, P> UnwindSafe for TextHidden<C, P>where
C: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more