Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
aniko33 authored Sep 4, 2023
1 parent 8deeda0 commit 75b036d
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 30 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ colored = "2.0.4"
salsa20 = "0.10.2"
chacha20 = "0.9.1"
arboard = { version = "3.2.1", features = ["wayland-data-control"] }
rand = "0.8.5"
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@

- AES256 GCM, Salsa20, Chacha20

- Crossplatform (Windows, Linux, MacOS tested)

- Add, remove, modify mode

- Login available with keyfile

- Copy password to clipboard

- Only offline mode

- No-SQL database (using JSON format)



## Installation

Expand Down Expand Up @@ -45,6 +51,18 @@ Options:

`kmh init mydb.kmh`



Choose whether to have a password or a keyfile

```textile
? What type of login do you want to use?
➤ Password
File
```



Choose cryptography

```textile
Expand All @@ -54,24 +72,53 @@ Choose cryptography
Chacha20-Poly1305
```

Login using DB password


Create a password

```textile
? Add a password: ******
[Ctrl + r for show password]
```

Or choose the size of the file (the bigger the better)

```textile
? Keyfile size
➤ 1024
2048
4096
```

Choose the name of the keyfile

```textile
choose the name of the file: mykeyfile.private
```



### Open DB

`kmh open mydb.kmh -e <encryption>`

For those who have a keyfile: `kmh open mydb.kmh -e <encryption> --file`

Insert DB password

```textile
? password: ******
[Ctrl + r for show password]
```

Or insert keyfile path

```textile
? Insert keyfile path: mykeyfile.private
```



Welcome to the main menu, enjoy

```textile
Expand Down
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cargo build -r
move target/release/kmh-cli .
move target\release\kmh-cli.exe .
2 changes: 2 additions & 0 deletions dev/build_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cargo build
./target/debug/kmh-cli $@
1 change: 1 addition & 0 deletions dev/clear.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm -rf target
12 changes: 10 additions & 2 deletions src/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ use aes_gcm::{
aead::{Aead, KeyInit},
Aes256Gcm, Error, Key, Nonce,
};
use chacha20::ChaCha20;
use rand::Rng;
use ring::digest::{digest, SHA256};
use salsa20::{
cipher::{KeyIvInit, StreamCipher, StreamCipherSeek},
Salsa20,
};

use chacha20::ChaCha20;

use crate::JsonDatabseKMH;

pub fn generate_random_utf8(size: usize) -> Vec<u8> {
let rand_string: String = rand::thread_rng()
.sample_iter::<char, _>(rand::distributions::Standard)
.take(size)
.collect();
rand_string.as_bytes().to_vec()
}

pub fn encrypt_database_aes(db: &Vec<JsonDatabseKMH>, password: &String) -> Result<Vec<u8>, Error> {
let password_hashed: [u8; 32] = digest(&SHA256, password.as_bytes())
.as_ref()
Expand Down
Loading

0 comments on commit 75b036d

Please sign in to comment.