keepsimple1 / libaes

A small and fast AES cipher in safe Rust
Apache License 2.0
25 stars 1 forks source link

convert encrypted text to string #28

Closed amirhossein-fzl closed 1 year ago

amirhossein-fzl commented 1 year ago

How can I convert encrypt to string? I write the following code, it gives this error...

std::str::from_utf8(&encrypted[..])

error: Err(Utf8Error { valid_up_to: 0, error_len: Some(1) })

keepsimple1 commented 1 year ago

By encrypt if you are referring to the encryption functions of this crate, the output is Vec<u8> that might or might not be a string.

amirhossein-fzl commented 1 year ago

By encrypt if you are referring to the encryption functions of this crate, the output is Vec<u8> that might or might not be a string.

So what's the point of this? When I can't store this password in the database, for example ...

keepsimple1 commented 1 year ago

You can store binary bytes into most databases. Don't have to convert into a string.