All Projects → RustCrypto → Hashes

RustCrypto / Hashes

Collection of cryptographic hash functions written in pure Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Hashes

Cryptoswift
CryptoSwift is a growing collection of standard and secure cryptographic algorithms implemented in Swift
Stars: ✭ 8,846 (+1263.02%)
Mutual labels:  md5, cryptography, sha1, digest
Checksum
Checksum calculation extensions for Swift
Stars: ✭ 28 (-95.69%)
Mutual labels:  md5, digest, sha1
Forge
A native implementation of TLS in Javascript and tools to write crypto-based and network-heavy webapps
Stars: ✭ 4,204 (+547.77%)
Mutual labels:  md5, cryptography, sha1
Openhashtab
📝 File hashing and checking shell extension
Stars: ✭ 599 (-7.7%)
Mutual labels:  md5, sha1
fhash
fHash - an open source files hash calculator for Windows and macOS
Stars: ✭ 222 (-65.79%)
Mutual labels:  md5, sha1
angular-crypto
angular-crypto provides standard and secure cryptographic algorithms for Angular.js with support for: MD5, SHA-1, SHA-256, RC4, Rabbit, AES, DES, PBKDF2, HMAC, OFB, CFB, CTR, CBC, Base64
Stars: ✭ 30 (-95.38%)
Mutual labels:  md5, sha1
Wjcryptlib
Public Domain C Library of Cryptographic functions. Including: MD5, SHA1, SHA256, SHA512, RC4, AES, AES-CTR, AES-OFB, AES-CBC
Stars: ✭ 250 (-61.48%)
Mutual labels:  md5, sha1
hmac.nim
HMAC-SHA1 and HMAC-MD5 hashing in Nim
Stars: ✭ 13 (-98%)
Mutual labels:  md5, sha1
hash-checker
Fast and simple application that allows you to generate and compare hashes from files and text
Stars: ✭ 72 (-88.91%)
Mutual labels:  md5, sha1
Jshashes
Fast and dependency-free cryptographic hashing library for node.js and browsers (supports MD5, SHA1, SHA256, SHA512, RIPEMD, HMAC)
Stars: ✭ 622 (-4.16%)
Mutual labels:  cryptography, sha1
hediye
Hash Generator & Cracker
Stars: ✭ 40 (-93.84%)
Mutual labels:  md5, sha1
ReSign
A burp extender that recalculate signature value automatically after you modified request parameter value.
Stars: ✭ 52 (-91.99%)
Mutual labels:  md5, sha1
Tripwire Open Source
Open Source Tripwire®
Stars: ✭ 513 (-20.96%)
Mutual labels:  md5, sha1
BruteForce
A simple brute forcer written in GO for SHA1, SHA256, SHA512, MD5 and bcrypt
Stars: ✭ 49 (-92.45%)
Mutual labels:  md5, sha1
WebCrypto.swift
A small collection of cryptographic functions based on the JavaScript WebCrypto API.
Stars: ✭ 16 (-97.53%)
Mutual labels:  digest, sha1
crypto.js
base on crypto module
Stars: ✭ 13 (-98%)
Mutual labels:  md5, sha1
Hashrat
Hashing tool supporting md5,sha1,sha256,sha512,whirlpool,jh and hmac versions of these. Includes recursive file hashing and other features.
Stars: ✭ 46 (-92.91%)
Mutual labels:  md5, sha1
Encrypt Body Spring Boot Starter
(停止维护,替代品搜索:https://github.com/search?l=Java&q=encrypt&type=Repositories )SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA
Stars: ✭ 198 (-69.49%)
Mutual labels:  md5, sha1
Rufus
The Reliable USB Formatting Utility
Stars: ✭ 16,917 (+2506.63%)
Mutual labels:  md5, sha1
hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (-41.14%)
Mutual labels:  md5, sha1

RustCrypto: hashes Project Chat dependency status

Collection of cryptographic hash functions written in pure Rust.

All algorithms reside in the separate crates and implemented using traits from digest crate. Additionally all crates do not require the standard library (i.e. no_std capable) and can be easily used for bare-metal or WebAssembly programming.

Supported algorithms

Note: For new applications, or where compatibility with other existing standards is not a primary concern, we strongly recommend to use either BLAKE2, SHA-2 or SHA-3.

Name Algorithm Crates.io Documentation Build Status Security
blake2 BLAKE2 crates.io Documentation build 💚
gost94 GOST94 (GOST R 34.11-94) crates.io Documentation build 💛
groestl Grøstl (Groestl) crates.io Documentation build 💚
k12 KangarooTwelve crates.io Documentation build 💚
md2 MD2 crates.io Documentation build 💔
md4 MD4 crates.io Documentation build 💔
md-5 ❗️ MD5 crates.io Documentation build 💔
ripemd160 RIPEMD-160 crates.io Documentation build 💚
ripemd320 RIPEMD-320 crates.io Documentation build 💚*
sha-1 ❗️ SHA-1 crates.io Documentation build 💔
sha2 SHA-2 crates.io Documentation build 💚
sha3 SHA-3 (Keccak) crates.io Documentation build 💚
shabal SHABAL crates.io Documentation build 💚
streebog Streebog (GOST R 34.11-2012) crates.io Documentation build 💛
tiger Tiger crates.io Documentation build 💚
whirlpool Whirlpool crates.io Documentation build 💚

NOTE: the BLAKE3 crate implements the digest (and crypto-mac) traits used by the rest of the hashes in this repository, but is maintained by the BLAKE3 team.

* RIPEMD-320 provides only the same security as RIPEMD-160

Crate names

Whenever possible crates are published under the the same name as the crate folder. Owners of md5 and sha1 crates declined (1, 2) to participate in this project. This is why crates marked by ❗️ are published under md-5 and sha-1 names respectively.

Security Level Legend

The following describes the security level ratings associated with each hash function (i.e. algorithms, not the specific implementation):

Heart Description
💚 No known successful attacks
💛 Theoretical break: security lower than claimed
💔 Attack demonstrated in practice: avoid if at all possible

See the Security page on Wikipedia for more information.

Minimum Supported Rust Version (MSRV)

All crates in this repository support Rust 1.21 or higher. In future minimally supported version of Rust can be changed, but it will be done with a minor version bump.

Usage

Let us demonstrate how to use crates in this repository using BLAKE2b as an example.

First add blake2 crate to your Cargo.toml:

[dependencies]
blake2 = "0.9"

Note that crates in this repository have an enabled by default std feature. So if you plan to use the crate in no_std enviroments, don't forget to disable it:

[dependencies]
blake2 = { version="0.9", default-features = false }

blake2 and other crates re-export digest crate and Digest trait for convenience, so you don't have to add digest crate as an explicit dependency.

Now you can write the following code:

use blake2::{Blake2b, Digest};

let mut hasher = Blake2b::new();
let data = b"Hello world!";
hasher.update(data);
// `update` can be called repeatedly and is generic over `AsRef<[u8]>`
hasher.update("String data");
// Note that calling `finalize()` consumes hasher
let hash = hasher.finalize();
println!("Result: {:x}", hash);

In this example hash has type GenericArray<u8, U64>, which is a generic alternative to [u8; 64].

Alternatively you can use chained approach, which is equivalent to the previous example:

use blake2::{Blake2b, Digest};

let hash = Blake2b::new()
    .chain(b"Hello world!")
    .chain("String data")
    .finalize();
println!("Result: {:x}", hash);

If the whole message is available you also can use convinience digest method:

use blake2::{Blake2b, Digest};

let hash = Blake2b::digest(b"my message");
println!("Result: {:x}", hash);

Hashing Readable objects

If you want to hash data from Read trait (e.g. from file) you can rely on implementation of Write trait (requires an enabled-by-default std feature):

use blake2::{Blake2b, Digest};
use std::{fs, io};

let mut file = fs::File::open(&path)?;
let mut hasher = Blake2b::new();
let n = io::copy(&mut file, &mut hasher)?;
let hash = hasher.finalize();
println!("Path: {}", path);
println!("Bytes processed: {}", n);
println!("Hash value: {:x}", hash);

Hash-based Message Authentication Code (HMAC)

If you want to calculate Hash-based Message Authentication Code (HMAC), you can use generic implementation from hmac crate, which is a part of the RustCrypto/MACs repository.

Generic code

You can write generic code over Digest (or other traits from digest crate) trait which will work over different hash functions:

use digest::Digest;
use blake2::Blake2b;
use sha2::Sha256;

// Toy example, do not use it in practice!
// Instead use crates from: https://github.com/RustCrypto/password-hashing
fn hash_password<D: Digest>(password: &str, salt: &str, output: &mut [u8]) {
    let mut hasher = D::new();
    hasher.update(password.as_bytes());
    hasher.update(b"$");
    hasher.update(salt.as_bytes());
    output.copy_from_slice(&hasher.finalize())
}

let mut buf1 = [0u8; 64];
hash_password::<Blake2b>("my_password", "abcd", &mut buf1);

let mut buf2 = [0u8; 32];
hash_password::<Sha256>("my_password", "abcd", &mut buf2);

If you want to use hash functions with trait objects, use digest::DynDigest trait.

License

All crates licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].