hashlib
A pure-Dart library of secure hash functions, checksums, MACs, key-derivation functions, OTP generators, and secure random — a broad, fast, dependency-light toolbox that runs everywhere Dart does.
hashlib is the middle layer of a three-package family:
It builds on convertlib for hex, Base32/Base64, and UTF-8 conversion, and
that is its only runtime dependency.
Highlights
- Runs on every platform: pure Dart with no native code or FFI, so the same library works everywhere Dart does — the VM, Flutter (Android, iOS, Windows, macOS, Linux), and the web (dart2js and dart2wasm).
- Batteries included: over a dozen hash families (MD, SHA-1, SHA-2, SHA-3, SHAKE, Keccak, BLAKE2, RIPEMD, SM3, xxHash), checksums (CRC, Adler-32), MACs (HMAC, Poly1305), password KDFs (Argon2, scrypt, bcrypt, PBKDF2), TOTP/HOTP, and RNG/UUID generators.
- One-shot or streaming: hash a
Stringor byte buffer in a single call, or feed data incrementally through a reusable sink for large or chunked input. - Password-grade KDFs: Argon2id, scrypt, bcrypt, and PBKDF2 with named
securitypresets that make the cost/latency trade-off explicit. - Fast: consistently outruns
crypto,PointyCastle, andhash, see the benchmarks below. - Codecs and secure random built in: companion
codecsandrandomlibraries ship in the same package.
Install
dependencies:
hashlib: ^2.4.2
or run dart pub add hashlib. A single import exposes every algorithm:
import 'package:hashlib/hashlib.dart';
Two companion libraries pair well with it — codecs for hex/Base/UTF-8
conversion (re-exported from convertlib) and random for secure random bytes,
numbers, and UUIDs:
import 'package:hashlib/codecs.dart'; // toHex, fromHex, toBase64, toUtf8
import 'package:hashlib/random.dart'; // randomBytes, uuid, HashlibRandom
Full API reference: hashlib library.
Quickstart
Compute a digest of a string in one call, and derive an HMAC from any hash by attaching a key:
import 'package:hashlib/hashlib.dart';
void main() {
final text = 'Happy Hashing!';
// One-shot hex digest
print(sha256.string(text));
// Keyed HMAC-SHA256
print(sha256.hmac.byString('password').string(text));
}
Supported algorithms
Block hash algorithms
| Algorithm | Available methods | Source |
|---|---|---|
| MD2 | md2, md2sum |
RFC-1319 |
| MD4 | md4, md4sum |
RFC-1320 |
| MD5 | md5, md5sum |
RFC-1321 |
| SHA-1 | sha1, sha1sum |
RFC-3174 |
| SHA-2 | sha224, sha256, sha384, sha512, sha512t224, sha512t256 |
RFC-6234 |
| SHA-3 | sha3_224, sha3_256, sha3_384, sha3_512 |
FIPS-202 |
| SHAKE-128 | Shake128, shake128, shake128_128, shake128_256 |
FIPS-202 |
| SHAKE-256 | Shake256, shake256, shake256_256, shake256_512 |
FIPS-202 |
| Keccak | keccak224, keccak256, keccak384, keccak512 |
Team Keccak |
| Blake2b | blake2b160, blake2b256, blake2b384, blake2b512 |
RFC-7693 |
| Blake2s | blake2s128, blake2s160, blake2s224, blake2s256 |
RFC-7693 |
| xxHash-32 | XXHash32, xxh32, xxh32code |
Cyan4973 |
| xxHash-64 | XXHash64, xxh64, xxh64code |
Cyan4973 |
| xxHash3-64 | XXH3, xxh3, xxh3code |
Cyan4973 |
| xxHash3-128 | XXH128, xxh128, xxh128code |
Cyan4973 |
| RIPEMD | ripemd128, ripemd256, ripemd160, ripemd320 |
ISO/IEC 10118-3:2018 |
| SM3 | sm3, sm3sum |
GB/T 32905-2016 |
Note:
XXHash64,XXH3, andXXH128are not supported on the web platform. They throwUnimplementedErrorwhen used there.
Password / key derivation algorithms
| Algorithm | Available methods | Source |
|---|---|---|
| Argon2 | Argon2, argon2d, argon2i, argon2id, argon2Verify |
RFC-9106 |
| PBKDF2 | PBKDF2, pbkdf2, #.pbkdf2 |
RFC-8081 |
| scrypt | Scrypt, scrypt |
RFC-7914 |
| bcrypt | Bcrypt, bcrypt, bcryptSalt, bcryptVerify, bcryptDigest |
Message authentication codes (MAC)
| Algorithm | Available methods | Source |
|---|---|---|
| HMAC | HMAC, #.hmac |
RFC-2104 |
| Poly1305 | Poly1305, poly1305, poly1305auth |
RFC-8439 |
One-time passwords (2FA)
| Algorithm | Available methods | Source |
|---|---|---|
| HOTP | HOTP |
RFC-4226 |
| TOTP | TOTP |
RFC-6238 |
Checksums
| Algorithm | Available methods | Source |
|---|---|---|
| CRC | crc16, crc32, crc64 |
Wikipedia |
| Adler-32 | adler32 |
Wikipedia |
Random and UUID
The random library provides random number generators through HashlibRandom
(secure, system, keccak, sha256, md5, xxh64, sm3), plus helpers
like randomBytes, randomNumbers, and randomString. UUID versions v1, v3,
v4, v5, v6, v7, and v8 are available through uuid.
Security notes
- Hash passwords with a KDF, not a bare hash. Store
argon2id(orscrypt/bcrypt) output with an appropriatesecuritypreset — never a plainsha256of a password — and check it withargon2Verify/bcryptVerify. - Compare digests in constant time. Use
HashDigest.isEqualwhen verifying MACs and digests instead of==or a manual byte loop, to avoid leaking information through timing. - Legacy algorithms are for compatibility only. MD2, MD4, MD5, and SHA-1 are cryptographically broken; use them only for interop or non-security checksums, and prefer SHA-256, SHA-3, or BLAKE2 for new work.
- Non-cryptographic hashes. CRC, Adler-32, and the xxHash family are fast integrity and lookup hashes, not secure against adversaries — do not use them where collision or preimage resistance matters.
- Runtime timing. Pure-Dart execution (JIT, AOT, dart2js) is not guaranteed to run in constant time; weigh the deployment environment before relying on it in side-channel-sensitive settings.
Testing and reliability
Correctness is the first-order goal of this library, and the test suite is built to enforce it. There are 700 test cases across 60+ files` that runs after every change and before each release across three platforms: the Dart VM, Node.js, and Chrome (WASM).
Every algorithm is checked in several independent ways:
- Official known-answer vectors. Digests are pinned against the published test vectors from the relevant standard — RFCs, FIPS/NIST publications, and each algorithm's reference implementation. Expected values are never invented; each vector cites its source in the test file.
- Differential cross-validation. For every algorithm that a mature,
independent Dart package also implements, the output is compared byte-for-byte
against
cryptoandpointycastleover hundreds of random inputs. This currently covers MD2, MD4, MD5, SHA-1, SHA-224/256/384/512, SHA-512/224, SHA-512/256, SHA3 (224–512), Keccak (224–512), RIPEMD-128/160/256/320, BLAKE2b, SM3, and HMAC. A subtle divergence in padding, endianness, or a block boundary would fail these tests even if it slipped past a fixed vector. - Boundary and edge coverage. Inputs are exercised at the empty string,
single bytes, and lengths straddling each algorithm's internal block/rate
size (e.g.
block−1,block,block+1, and multi-block messages) - the exact places where length-encoding and padding bugs hide. - Streaming equals one-shot. Chunked/streamed input and the incremental
SinkAPI (includingreset(), double-close(), and use-after-close) are verified to produce identical digests to the one-shot path. - Argument validation. Invalid key, salt, digest, and parameter lengths are asserted to throw typed errors rather than silently producing weak output.
The algorithms compute exactly what their standards define, verified against official vectors and multiple independent implementations. Please still read the Security notes above: choose the right primitive for your threat model (a KDF for passwords, a cryptographic hash rather than a checksum where an adversary is involved), and note that pure-Dart execution makes no hard constant-time guarantee.
You can reproduce all of this locally:
dart test # vm, node, and chrome
dart test -p vm # fast, VM-only iteration
Recipes
Runnable programs for every snippet below live in the example folder.
Hashing, checksums, MAC, and OTP
import 'package:hashlib/codecs.dart';
import 'package:hashlib/hashlib.dart';
void main() {
var text = "Happy Hashing!";
print("text => $text");
final key = "password";
final salt = "some salt";
print("key => $key");
print("salt => $salt");
print('');
final pw = key.codeUnits;
final iv = salt.codeUnits;
// Example of hash-code generations
print('XXH32 => ${xxh32code(text)}');
print('CRC32 => ${crc32code(text)}');
print('Adler32 => ${adler32code(text)}');
print('CRC16 => ${crc16code(text)}');
print('');
// Examples of Hash generation
print('CRC64 => ${crc64sum(text)}');
print('XXH64 => ${xxh64sum(text)}');
print('XXH3 => ${xxh3sum(text)}');
print('XXH128 => ${xxh128sum(text)}');
print('MD2 => ${md2.string(text)}');
print('MD4 => ${md4.string(text)}');
print('MD5 => ${md5.string(text)}');
print('SHA-1 => ${sha1.string(text)}');
print('SHA-224 => ${sha224.string(text)}');
print('SHA-256 => ${sha256.string(text)}');
print('SHA-384 => ${sha384.string(text)}');
print('SHA-512 => ${sha512.string(text)}');
print('SHA-512/224 => ${sha512t224.string(text)}');
print('SHA-512/256 => ${sha512t256.string(text)}');
print('SHA3-224 => ${sha3_224.string(text)}');
print('SHA3-256 => ${sha3_256.string(text)}');
print('SHA3-384 => ${sha3_384.string(text)}');
print('SHA3-512 => ${sha3_512.string(text)}');
print('Keccak-224 => ${keccak224.string(text)}');
print('Keccak-256 => ${keccak256.string(text)}');
print('Keccak-384 => ${keccak384.string(text)}');
print('Keccak-512 => ${keccak512.string(text)}');
print('SHAKE-128 => ${shake128.of(20).string(text)}');
print('SHAKE-256 => ${shake256.of(20).string(text)}');
print('BLAKE2s-256 => ${blake2s256.string(text)}');
print('BLAKE2b-512 => ${blake2b512.string(text)}');
print('SM3 => ${sm3.string(text)}');
print('');
// Examples of MAC generations
print('HMAC/MD5 => ${md5.hmac.by(pw).string(text)}');
print('HMAC/SHA1 => ${sha1.hmac.byString(text)}');
print('HMAC/SHA256 => ${sha256.hmac.byString(key).string(text)}');
print('HMAC/SHA3-256 => ${HMAC(sha3_256).by(pw).string(text)}');
print("HMAC/BLAKE2b-256 => ${blake2b512.hmac.by(pw).string(text)}");
print("BLAKE-2b-MAC/256 => ${blake2b256.mac.by(pw).string(text)}");
print("BLAKE-2b-MAC/224 => ${Blake2b(28).mac.by(pw).string(text)}");
print('');
// Examples of OTP generation
int nw = DateTime.now().millisecondsSinceEpoch ~/ 30000;
var counter = fromHex(nw.toRadixString(16).padLeft(16, '0'));
print('TOTP[time=$nw] => ${TOTP(iv).value()}');
print('HOTP[counter=$nw] => ${HOTP(iv, counter: counter).value()}');
print('');
}
Password and key derivation
import 'package:hashlib/hashlib.dart';
void main() {
final key = "password";
final salt = "some salt";
print("key => $key");
print("salt => $salt");
print('');
final pw = key.codeUnits;
final iv = salt.codeUnits;
// Examples of Argon2 key derivation
final argon2Test = Argon2Security.test;
print("[Argon2i] => ${argon2i(pw, iv, security: argon2Test)}");
print("[Argon2d] => ${argon2d(pw, iv, security: argon2Test)}");
print("[Argon2id] => ${argon2id(pw, iv, security: argon2Test)}");
// Examples of scrypt key derivation
final scryptLittle = ScryptSecurity.little;
print("[scrypt] => ${scrypt(pw, iv, security: scryptLittle, dklen: 24)}");
print('');
// Examples of bcrypt key derivation
final bcryptLittle = BcryptSecurity.little;
print("[bcrypt] => ${bcrypt(pw, bcryptSalt(security: bcryptLittle))}");
print('');
// Examples of PBKDF2 key derivation
print("SHA256/HMAC/PBKDF2 => ${pbkdf2(pw, iv).hex()}");
print("BLAKE2b-256/HMAC/PBKDF2 => ${blake2b256.pbkdf2(iv).hex(pw)}");
print("BLAKE2b-256/MAC/PBKDF2 => ${blake2b256.mac.pbkdf2(iv).hex(pw)}");
print("SHA1/HMAC/PBKDF2 => ${sha1.pbkdf2(iv, iterations: 100).hex(pw)}");
print('');
}
Secure random and UUID
import 'package:hashlib/codecs.dart';
import 'package:hashlib/random.dart';
void main() {
print('UUID Generation:');
print('UUIDv1: ${uuid.v1()}');
print('UUIDv3: ${uuid.v3()}');
print('UUIDv4: ${uuid.v4()}');
print('UUIDv5: ${uuid.v5()}');
print('UUIDv6: ${uuid.v6()}');
print('UUIDv7: ${uuid.v7()}');
print('UUIDv8: ${uuid.v8()}');
print('');
print('Random Generation:');
print(randomNumbers(4));
print(toHex(randomBytes(16)));
print(randomString(32, lower: true, whitelist: '_'.codeUnits));
print('');
}
Benchmarks
Libraries
- Hashlib : https://pub.dev/packages/hashlib
- Crypto : https://pub.dev/packages/crypto
- PointyCastle : https://pub.dev/packages/pointycastle
- Hash : https://pub.dev/packages/hash
Hash Functions
| Algorithm | Library | 5MB message | 1KB message | 10B message |
|---|---|---|---|---|
| MD4 | hashlib | ████████████████ 1.72 Gbps 🌟 |
████████████████ 1.64 Gbps 🌟 |
████████████████ 285 Mbps 🌟 |
| PointyCastle | ████████░░░░░░░░ 888 Mbps 🔻1.94x |
████████░░░░░░░░ 846 Mbps 🔻1.94x |
█████████░░░░░░░ 163 Mbps 🔻1.75x |
|
| MD5 | hashlib | ████████████████ 1.47 Gbps 🌟 |
████████████████ 1.32 Gbps 🌟 |
████████████████ 216 Mbps 🌟 |
| crypto | ███████████████░ 1.38 Gbps 🔻1.06x |
████████████████ 1.29 Gbps 🔻1.03x |
███████████████░ 205 Mbps 🔻1.05x |
|
| hash | ██████████░░░░░░ 952 Mbps 🔻1.55x |
███████████░░░░░ 904 Mbps 🔻1.47x |
█████░░░░░░░░░░░ 69.73 Mbps 🔻3.1x |
|
| PointyCastle | ████████░░░░░░░░ 737 Mbps 🔻2x |
█████████░░░░░░░ 705 Mbps 🔻1.88x |
█████████░░░░░░░ 125 Mbps 🔻1.73x |
|
| HMAC(MD5) | hashlib | ████████████████ 1.4 Gbps 🌟 |
██████████████░░ 987 Mbps |
████████████░░░░ 43.81 Mbps |
| crypto | ████████████████ 1.37 Gbps 🔻1.02x |
████████████████ 1.1 Gbps 🔺1.12x |
████████████████ 56.83 Mbps 🔺1.3x |
|
| hash | ██████████░░░░░░ 898 Mbps 🔻1.56x |
██████████░░░░░░ 666 Mbps 🔻1.48x |
█████░░░░░░░░░░░ 19.44 Mbps 🔻2.25x |
|
| SHA-1 | hashlib | ████████████████ 1.26 Gbps 🌟 |
████████████████ 1.16 Gbps 🌟 |
███████████████░ 153 Mbps |
| crypto | ██████████████░░ 1.11 Gbps 🔻1.13x |
███████████████░ 1.08 Gbps 🔻1.07x |
████████████████ 167 Mbps 🔺1.09x |
|
| PointyCastle | ██████░░░░░░░░░░ 478 Mbps 🔻2.64x |
██████░░░░░░░░░░ 464 Mbps 🔻2.49x |
███████░░░░░░░░░ 75.97 Mbps 🔻2.01x |
|
| hash | ███████░░░░░░░░░ 533 Mbps 🔻2.36x |
███████░░░░░░░░░ 524 Mbps 🔻2.21x |
█████░░░░░░░░░░░ 54 Mbps 🔻2.83x |
|
| HMAC(SHA-1) | hashlib | ████████████████ 1.27 Gbps 🌟 |
████████████████ 805 Mbps |
█████████████░░░ 21.93 Mbps |
| crypto | ██████████████░░ 1.11 Gbps 🔻1.15x |
████████████████ 812 Mbps 🔺1.01x |
████████████████ 26.82 Mbps 🔺1.22x |
|
| SHA-224 | hashlib | ████████████████ 1.02 Gbps 🌟 |
████████████████ 868 Mbps 🌟 |
████████████████ 120 Mbps 🌟 |
| crypto | ██████████████░░ 913 Mbps 🔻1.12x |
███████████████░ 838 Mbps 🔻1.04x |
████████████████ 118 Mbps 🔻1.01x |
|
| hash | ████░░░░░░░░░░░░ 245 Mbps 🔻4.19x |
████░░░░░░░░░░░░ 228 Mbps 🔻3.81x |
████░░░░░░░░░░░░ 29.68 Mbps 🔻4.05x |
|
| PointyCastle | ███░░░░░░░░░░░░░ 219 Mbps 🔻4.68x |
████░░░░░░░░░░░░ 222 Mbps 🔻3.91x |
█████░░░░░░░░░░░ 36.69 Mbps 🔻3.27x |
|
| SHA-256 | hashlib | ████████████████ 1.03 Gbps 🌟 |
████████████████ 941 Mbps 🌟 |
████████████████ 121 Mbps |
| crypto | ███████████████░ 944 Mbps 🔻1.09x |
███████████████░ 864 Mbps 🔻1.09x |
████████████████ 123 Mbps 🔺1.02x |
|
| hash | ████░░░░░░░░░░░░ 243 Mbps 🔻4.22x |
████░░░░░░░░░░░░ 224 Mbps 🔻4.21x |
████░░░░░░░░░░░░ 30.65 Mbps 🔻3.94x |
|
| PointyCastle | ████░░░░░░░░░░░░ 235 Mbps 🔻4.36x |
████░░░░░░░░░░░░ 220 Mbps 🔻4.28x |
█████░░░░░░░░░░░ 36.27 Mbps 🔻3.33x |
|
| HMAC(SHA-256) | hashlib | ████████████████ 1.04 Gbps 🌟 |
████████████████ 651 Mbps |
██████████████░░ 17.88 Mbps |
| crypto | ███████████████░ 942 Mbps 🔻1.1x |
████████████████ 651 Mbps 🔺1x |
████████████████ 20.2 Mbps 🔺1.13x |
|
| SHA-384 | hashlib | ████████████████ 1.96 Gbps 🌟 |
████████████████ 1.65 Gbps 🌟 |
████████████████ 105 Mbps 🌟 |
| crypto | █████░░░░░░░░░░░ 654 Mbps 🔻3x |
██████░░░░░░░░░░ 591 Mbps 🔻2.8x |
████████░░░░░░░░ 51.35 Mbps 🔻2.05x |
|
| hash | █░░░░░░░░░░░░░░░ 172 Mbps 🔻11.43x |
██░░░░░░░░░░░░░░ 161 Mbps 🔻10.27x |
██░░░░░░░░░░░░░░ 14.32 Mbps 🔻7.36x |
|
| PointyCastle | █░░░░░░░░░░░░░░░ 50.49 Mbps 🔻38.88x |
█░░░░░░░░░░░░░░░ 44.81 Mbps 🔻36.9x |
█░░░░░░░░░░░░░░░ 3.86 Mbps 🔻27.28x |
|
| SHA-512 | hashlib | ████████████████ 1.97 Gbps 🌟 |
████████████████ 1.64 Gbps 🌟 |
████████████████ 102 Mbps 🌟 |
| crypto | █████░░░░░░░░░░░ 655 Mbps 🔻3x |
██████░░░░░░░░░░ 590 Mbps 🔻2.78x |
████████░░░░░░░░ 50.24 Mbps 🔻2.04x |
|
| hash | █░░░░░░░░░░░░░░░ 173 Mbps 🔻11.36x |
██░░░░░░░░░░░░░░ 160 Mbps 🔻10.23x |
██░░░░░░░░░░░░░░ 14.37 Mbps 🔻7.13x |
|
| PointyCastle | █░░░░░░░░░░░░░░░ 49.25 Mbps 🔻39.91x |
█░░░░░░░░░░░░░░░ 43.61 Mbps 🔻37.58x |
█░░░░░░░░░░░░░░░ 3.75 Mbps 🔻27.33x |
|
| SHA3-224 | hashlib | ████████████████ 1.03 Gbps 🌟 |
████████████████ 913 Mbps 🌟 |
████████████████ 116 Mbps 🌟 |
| PointyCastle | █░░░░░░░░░░░░░░░ 31.33 Mbps 🔻32.73x |
█░░░░░░░░░░░░░░░ 27.45 Mbps 🔻33.25x |
█░░░░░░░░░░░░░░░ 2.13 Mbps 🔻54.28x |
|
| SHA3-256 | hashlib | ████████████████ 1.03 Gbps 🌟 |
████████████████ 941 Mbps 🌟 |
████████████████ 120 Mbps 🌟 |
| PointyCastle | █░░░░░░░░░░░░░░░ 29.91 Mbps 🔻34.28x |
█░░░░░░░░░░░░░░░ 27.96 Mbps 🔻33.67x |
█░░░░░░░░░░░░░░░ 2.14 Mbps 🔻56.1x |
|
| SHA3-384 | hashlib | ████████████████ 1.94 Gbps 🌟 |
████████████████ 1.65 Gbps 🌟 |
████████████████ 104 Mbps 🌟 |
| PointyCastle | █░░░░░░░░░░░░░░░ 22.7 Mbps 🔻85.4x |
█░░░░░░░░░░░░░░░ 22.47 Mbps 🔻73.34x |
█░░░░░░░░░░░░░░░ 2.16 Mbps 🔻47.82x |
|
| SHA3-512 | hashlib | ████████████████ 1.91 Gbps 🌟 |
████████████████ 1.63 Gbps 🌟 |
████████████████ 101 Mbps 🌟 |
| PointyCastle | █░░░░░░░░░░░░░░░ 15.8 Mbps 🔻121.05x |
█░░░░░░░░░░░░░░░ 14.79 Mbps 🔻110.1x |
█░░░░░░░░░░░░░░░ 2.14 Mbps 🔻47.04x |
|
| RIPEMD-128 | hashlib | ████████████████ 1.41 Gbps 🌟 |
████████████████ 1.33 Gbps 🌟 |
████████████████ 195 Mbps 🌟 |
| PointyCastle | █████░░░░░░░░░░░ 462 Mbps 🔻3.05x |
█████░░░░░░░░░░░ 438 Mbps 🔻3.03x |
██████░░░░░░░░░░ 78.39 Mbps 🔻2.48x |
|
| RIPEMD-160 | hashlib | ████████████████ 743 Mbps 🌟 |
████████████████ 698 Mbps 🌟 |
████████████████ 108 Mbps 🌟 |
| hash | ████████░░░░░░░░ 373 Mbps 🔻1.99x |
████████░░░░░░░░ 359 Mbps 🔻1.95x |
██████░░░░░░░░░░ 43.29 Mbps 🔻2.48x |
|
| PointyCastle | ███████░░░░░░░░░ 335 Mbps 🔻2.22x |
███████░░░░░░░░░ 317 Mbps 🔻2.2x |
████████░░░░░░░░ 54.48 Mbps 🔻1.97x |
|
| RIPEMD-256 | hashlib | ████████████████ 1.56 Gbps 🌟 |
████████████████ 1.44 Gbps 🌟 |
████████████████ 220 Mbps 🌟 |
| PointyCastle | █████░░░░░░░░░░░ 468 Mbps 🔻3.33x |
█████░░░░░░░░░░░ 440 Mbps 🔻3.29x |
█████░░░░░░░░░░░ 74.18 Mbps 🔻2.97x |
|
| RIPEMD-320 | hashlib | ████████████████ 713 Mbps 🌟 |
████████████████ 669 Mbps 🌟 |
████████████████ 105 Mbps 🌟 |
| PointyCastle | ███████░░░░░░░░░ 331 Mbps 🔻2.15x |
████████░░░░░░░░ 314 Mbps 🔻2.13x |
████████░░░░░░░░ 51.56 Mbps 🔻2.03x |
|
| BLAKE-2s | hashlib | ████████████████ 1.69 Gbps 🌟 |
████████████████ 1.67 Gbps 🌟 |
████████████████ 203 Mbps 🌟 |
| BLAKE-2b | hashlib | ████████████████ 2.06 Gbps 🌟 |
████████████████ 2.07 Gbps 🌟 |
████████████████ 181 Mbps 🌟 |
| PointyCastle | █░░░░░░░░░░░░░░░ 120 Mbps 🔻17.09x |
█░░░░░░░░░░░░░░░ 119 Mbps 🔻17.45x |
█░░░░░░░░░░░░░░░ 9.26 Mbps 🔻19.56x |
|
| Poly1305 | hashlib | ████████████████ 4.59 Gbps 🌟 |
████████████████ 4.48 Gbps 🌟 |
████████████████ 595 Mbps 🌟 |
| PointyCastle | ████░░░░░░░░░░░░ 1.18 Gbps 🔻3.88x |
████░░░░░░░░░░░░ 1.16 Gbps 🔻3.87x |
████████░░░░░░░░ 310 Mbps 🔻1.92x |
|
| XXH32 | hashlib | ████████████████ 5.9 Gbps 🌟 |
████████████████ 5.6 Gbps 🌟 |
████████████████ 789 Mbps 🌟 |
| XXH64 | hashlib | ████████████████ 3.63 Gbps 🌟 |
████████████████ 3.3 Gbps 🌟 |
████████████████ 639 Mbps 🌟 |
| XXH3 | hashlib | ████████████████ 1.46 Gbps 🌟 |
████████████████ 1.23 Gbps 🌟 |
████████████████ 70.49 Mbps 🌟 |
| XXH128 | hashlib | ████████████████ 1.43 Gbps 🌟 |
████████████████ 1.21 Gbps 🌟 |
████████████████ 68.5 Mbps 🌟 |
| SM3 | hashlib | ████████████████ 947 Mbps 🌟 |
████████████████ 862 Mbps 🌟 |
████████████████ 136 Mbps 🌟 |
| PointyCastle | ████░░░░░░░░░░░░ 241 Mbps 🔻3.93x |
████░░░░░░░░░░░░ 228 Mbps 🔻3.78x |
████░░░░░░░░░░░░ 37.31 Mbps 🔻3.65x |
Key Derivators
| Algorithm | little | moderate | good | strong |
|---|---|---|---|---|
| scrypt | █░░░░░░░░░░░░░░░ 1.01 ms |
█░░░░░░░░░░░░░░░ 11.21 ms |
█░░░░░░░░░░░░░░░ 61.03 ms |
████████████████ 2033.95 ms |
| bcrypt | █░░░░░░░░░░░░░░░ 2.7 ms |
█░░░░░░░░░░░░░░░ 20.6 ms |
██░░░░░░░░░░░░░░ 331.8 ms |
████████████████ 2650.52 ms |
| pbkdf2 | █░░░░░░░░░░░░░░░ 0.42 ms |
█░░░░░░░░░░░░░░░ 14.05 ms |
█░░░░░░░░░░░░░░░ 232.89 ms |
████████████████ 2777.65 ms |
| argon2i | █░░░░░░░░░░░░░░░ 2.37 ms |
█░░░░░░░░░░░░░░░ 14.86 ms |
█░░░░░░░░░░░░░░░ 192.95 ms |
████████████████ 2087.93 ms |
| argon2d | █░░░░░░░░░░░░░░░ 2.14 ms |
█░░░░░░░░░░░░░░░ 15.01 ms |
█░░░░░░░░░░░░░░░ 191.21 ms |
████████████████ 2094.69 ms |
| argon2id | █░░░░░░░░░░░░░░░ 2.11 ms |
█░░░░░░░░░░░░░░░ 14.68 ms |
█░░░░░░░░░░░░░░░ 192.04 ms |
████████████████ 2052.91 ms |
All benchmarks are done on 36GB Apple M3 Pro using compiled exe
Dart SDK version: 3.12.2 (stable) (Tue Jun 9 01:11:39 2026 -0700) on "macos_arm64"
License
BSD 3-Clause License. See the LICENSE file for details. Issues and contributions are welcome at github.com/bitanon/hashlib.