Skip to content

Commit a2ca768

Browse files
committed
Some improvements
1 parent bab6e6c commit a2ca768

File tree

12 files changed

+349
-368
lines changed

12 files changed

+349
-368
lines changed

Cargo.lock

Lines changed: 314 additions & 316 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "effer"
5-
version = "2.0.0"
5+
version = "2.0.1"
66
authors = ["madprops <[email protected]>"]
77
edition = "2018"
88

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ To check using a debug version:
8181
To build an optimized binary
8282
>cargo build --release
8383
84-
Or just use the binary provided in the latest release.
85-
86-
There's a simple bash script to move the release binary to /bin
87-
88-
The version in Cargo.toml doesn't reflect the program's version.
89-
9084
# Arguments
9185

9286
Check --help to find out about arguments that can be used.

install.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

pom

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@t
2+
�PD��t��,z��Q��*@ѡS�h� ��қC�p��٧��|��<D�r1v8-��QL`�nu���{��

src/encryption.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl EncryptedData {
153153

154154
fn decrypt(&self, password: &str) -> Result<Vec<u8>, ()> {
155155
if self.derivation == 0 {
156-
return Ok(self.ciphertext.clone());
156+
Ok(self.ciphertext.clone())
157157
} else {
158158
let key = key_from_pw(password, self.salt, self.derivation)?;
159159
aead::open(&self.ciphertext, Some(&self.salt.0), &self.nonce, &key)
@@ -165,10 +165,10 @@ impl EncryptedData {
165165
bytes.extend(self.salt.0.iter());
166166
bytes.extend(self.nonce.0.iter());
167167
bytes.extend(self.ciphertext.iter());
168-
return bytes;
168+
bytes
169169
}
170170

171-
fn from_bytes(bytes: &Vec<u8>) -> Result<Self, base64::DecodeError> {
171+
fn from_bytes(bytes: &[u8]) -> Result<Self, base64::DecodeError> {
172172
let n = 2;
173173
let sbytes = pwhash::SALTBYTES;
174174
let nbytes = aead::NONCEBYTES;
@@ -199,7 +199,7 @@ pub fn encrypt_text(plaintext: &str) -> Vec<u8> {
199199
}
200200

201201
// Decrypt the file's bytes
202-
pub fn decrypt_bytes(bytes: &Vec<u8>) -> String {
202+
pub fn decrypt_bytes(bytes: &[u8]) -> String {
203203
let ciphertext = EncryptedData::from_bytes(bytes).unwrap();
204204
let password = get_password(false);
205205

src/file.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub fn get_file_bytes() -> Vec<u8> {
158158
};
159159

160160
file.read_to_end(&mut bytes).unwrap();
161-
return bytes;
161+
bytes
162162
}
163163

164164
// Generic function to read text from files
@@ -435,13 +435,11 @@ pub fn do_open_path(pth: String, create: bool) {
435435
opath = path;
436436
g_set_path(pth);
437437

438-
if create {
439-
if !create_file() {
440-
g_set_password(opassword);
441-
g_set_path(opath);
442-
show_message("< Can't Create File >");
443-
return;
444-
}
438+
if create && !create_file() {
439+
g_set_password(opassword);
440+
g_set_path(opath);
441+
show_message("< Can't Create File >");
442+
return;
445443
}
446444

447445
let notes = get_notes(true);

src/globals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
};
1313

1414
// Constants
15-
pub const VERSION: &str = "v2.0.0";
15+
pub const VERSION: &str = "v2.0.1";
1616
pub const DEFAULT_PAGE_SIZE: usize = 10;
1717
pub const MAX_PAGE_SIZE: usize = 100;
1818
pub const PAGE_SIZE_DIFF: usize = 1;

src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#![allow(clippy::suspicious_else_formatting)]
2-
#![allow(clippy::collapsible_if)]
3-
41
mod arguments;
52
mod colors;
63
mod encryption;

src/modes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn show_stats() {
3030

3131
let enc_size = get_file_bytes().len();
3232
let dec_size = notes.as_bytes().len();
33-
let path = shell_contract(&g_get_path().to_string());
33+
let path = shell_contract(&g_get_path());
3434

3535
let s = format!("Stats For: {}\n\nNotes: {}\nWords: {}\nLetters: {}\nEncrypted Size: {} Bytes\nDecrypted Size: {} Bytes",
3636
path, len, wcount, lcount, enc_size, dec_size);

0 commit comments

Comments
 (0)