projects
/
rup.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c3ee58e
)
Cleaning
author
www-data
<www-data@ek>
Thu, 8 Aug 2019 08:34:55 +0000
(10:34 +0200)
committer
www-data
<www-data@ek>
Thu, 8 Aug 2019 08:34:55 +0000
(10:34 +0200)
src/crypto.rs
patch
|
blob
|
history
src/main.rs
patch
|
blob
|
history
diff --git
a/src/crypto.rs
b/src/crypto.rs
index
f415fa1
..
a7aa5b9
100644
(file)
--- a/
src/crypto.rs
+++ b/
src/crypto.rs
@@
-43,10
+43,8
@@
pub fn encrypt(key: &str, plain_text: &str) -> Result<String, EncryptError> {
let iv = rand::thread_rng().gen::<[u8; 16]>();
\r
\r
let cipher_text =
\r
let iv = rand::thread_rng().gen::<[u8; 16]>();
\r
\r
let cipher_text =
\r
- match symm::encrypt(symm::Cipher::aes_128_cbc(), &key_as_bytes, Some(&iv), text_as_bytes) {
\r
- Ok(t) => t,
\r
- Err(_e) => return Err(EncryptError::UnableToEncrypt)
\r
- };
\r
+ symm::encrypt(symm::Cipher::aes_128_cbc(), &key_as_bytes, Some(&iv), text_as_bytes)
\r
+ .map_err(|_e| EncryptError::UnableToEncrypt)?;
\r
\r
let hash_text = sha256(&text_as_bytes);
\r
\r
\r
let hash_text = sha256(&text_as_bytes);
\r
\r
diff --git
a/src/main.rs
b/src/main.rs
index
6c9ab27
..
f1e66ee
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-53,10
+53,10
@@
struct Config {
fn get_exe_name() -> String {
let first_arg = std::env::args().nth(0).unwrap();
fn get_exe_name() -> String {
let first_arg = std::env::args().nth(0).unwrap();
- //dbg!(&first_arg);
let sep: &[_] = &['\\', '/'];
first_arg[first_arg.rfind(sep).unwrap()+1..].to_string()
}
let sep: &[_] = &['\\', '/'];
first_arg[first_arg.rfind(sep).unwrap()+1..].to_string()
}
+
fn read_key() -> String {
let mut key = String::new();
File::open(consts::FILE_KEY)
fn read_key() -> String {
let mut key = String::new();
File::open(consts::FILE_KEY)