Skip to content

Commit

Permalink
Refactor project structure and update dependencies (#83)
Browse files Browse the repository at this point in the history
* Move main.rs to bin folder

* Refactor all modules to a library

* Rename library

* Update file paths and imports

* Update rustgenhash version to 0.9.0 in Cargo.lock and Cargo.toml
  • Loading branch information
vschwaberow authored Dec 19, 2023
1 parent 7be4363 commit 493f364
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustgenhash"
version = "0.8.5"
version = "0.9.0"
license = "MIT"
authors = ["Volker Schwaberow <[email protected]>"]
description = "A tool to generate hashes from the command line."
Expand All @@ -14,7 +14,7 @@ categories = ["command-line-utilities", "cryptography"]

[[bin]]
name = "rgh"
path = "src/main.rs"
path = "src/bin/main.rs"

[profile.release]
strip = "symbols"
Expand Down
6 changes: 1 addition & 5 deletions src/main.rs → src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
// Author: Volker Schwaberow <[email protected]>
// Copyright (c) 2022 Volker Schwaberow

mod analyze;
mod app;
mod hash;
mod hhhash;
mod random;
use rustgenhash::rgh::app;

fn main() -> Result<(), Box<dyn std::error::Error>> {
app::run()?;
Expand Down
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
// Project: rustgenhash
// File: analyze.rs
// Author: Volker Schwaberow <[email protected]>
// Copyright (c) 2022 Volker Schwaberow

pub mod rgh {
pub mod analyze;
pub mod app;
pub mod hash;
pub mod hhhash;
pub mod random;
}
File renamed without changes.
9 changes: 4 additions & 5 deletions src/app.rs → src/rgh/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
// Author: Volker Schwaberow <[email protected]>
// Copyright (c) 2022 Volker Schwaberow

use crate::analyze;
use crate::hash::{PHash, RHash};
use crate::hhhash::generate_hhhash;
use crate::random::{RandomNumberGenerator, RngType};
use analyze::HashAnalyzer;
use crate::rgh::analyze::HashAnalyzer;
use crate::rgh::hash::{PHash, RHash};
use crate::rgh::hhhash::generate_hhhash;
use crate::rgh::random::{RandomNumberGenerator, RngType};
use clap::{crate_name, Arg};
use clap_complete::{generate, Generator, Shell};
use std::error::Error;
Expand Down
3 changes: 1 addition & 2 deletions src/hash.rs → src/rgh/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Author: Volker Schwaberow <[email protected]>
// Copyright (c) 2022 Volker Schwaberow

use crate::app::OutputOptions;
use crate::rgh::app::OutputOptions;
use argon2::{
password_hash::{rand_core::OsRng, PasswordHasher, SaltString},
Argon2,
Expand Down Expand Up @@ -302,7 +302,6 @@ impl RHash {
}
}


#[test]
fn test_argon2() {
use argon2::PasswordVerifier;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/random.rs → src/rgh/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Author: Volker Schwaberow <[email protected]>
// Copyright (c) 2022 Volker Schwaberow

use crate::app::OutputOptions;
use crate::rgh::app::OutputOptions;
use base64::{encode_config, URL_SAFE_NO_PAD};
use getrandom::getrandom;
use rand::thread_rng;
Expand Down

0 comments on commit 493f364

Please sign in to comment.