identyhash 0.1.0

A CLI tool to identify hash types.
Documentation
# IdentYhash

IdentYhash is a Rust-based library for identifying various cryptographic hash types. It supports common hashing algorithms such as MD5, SHA-1, SHA-256, bcrypt, and more. This crate is useful for developers or security professionals who need to quickly identify the hash type of a given string.

**Current Version**: 0.1.0
**Author**: Trix Cyrus 
**Copyright**: © 2024 Trixsec Org
**Maintained**: Yes

## Installation

To use IdentYhash in your project, add it to your `Cargo.toml`:

```toml
[dependencies]
identyhash = "0.1.0"
```

## Usage

Here is an example of how to use IdentYhash to identify a hash:

```rust
use identyhash::identify_hash;

let hash = "d41d8cd98f00b204e9800998ecf8427e"; // MD5 hash
let result = identify_hash(hash);
println!("Hash type: {}", result);
```

This will output:
```
Hash type: MD5
```

## Functions

### `identify_hash(hash: &str) -> &str`

This function identifies the hash type of a given hash string. It recognizes multiple common hash types based on the hash length and format.

#### Arguments:
- `hash`: A string slice that holds the hash to identify.

#### Returns:
- A string representing the identified hash type (e.g., "MD5", "SHA-1", "bcrypt", etc.).

#### Example:
```rust
let hash = "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"; // SHA-1 hash
let result = identify_hash(hash);
println!("{}", result);  // Output: SHA-1
```

### `read_hashes_from_file(file_path: &str) -> io::Result<()>`

This function reads a file containing hashes, identifies each hash's type, and prints the result to the console.

#### Arguments:
- `file_path`: The path to the file containing hashes, each hash on a new line.

#### Returns:
- `Ok(())` if the function succeeds, or an `Err` if there is an error (e.g., file not found).

#### Example:
```rust
read_hashes_from_file("hashes.txt").unwrap();
```

## Hash Types Recognized

The following hash types are recognized by IdentYhash:

- **MD5**: 32 characters, hex-encoded.
- **SHA-1**: 40 characters, hex-encoded.
- **SHA-256**: 64 characters, hex-encoded.
- **SHA-384**: 96 characters, hex-encoded.
- **SHA-512**: 128 characters, hex-encoded.
- **bcrypt**: Prefixed with `$2a$`, `$2b$`, or `$2y$`.
- **bcrypt (Blowfish)**: 22 characters, alphanumeric.
- **MySQL (old)**: 16 characters.
- **NTLM**: 32 characters, alphanumeric.
- **CRC-32**: 24 characters, hex-encoded.
- **SHA3-256**: 80 characters, hex-encoded.
- **SHA3-512**: 104 characters, hex-encoded.
- **Whirlpool**: 256 characters, hex-encoded.
- **RipeMD-128**: 39 characters, hex-encoded.
- **MD5(Wordpress)**: 34 characters, prefixed with `$P$`.
- **Cisco-IOS (Type 7)**: 37 characters, prefixed with `$apr1$`.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.