crypto
3.0.8, released 4 weeks ago by dart.dev
Provides SHA, MD5, and HMAC hashing functions for Dart.
What it does
Implements common cryptographic hash algorithms (SHA‑1/224/256/384/512, MD5) and HMAC support. All code is pure Dart and works on every Flutter platform.
AI-written summary of version 3.0.8, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to compute hashes or HMACs locally in a Dart/Flutter app.
- You require a lightweight, pure‑Dart solution without native dependencies.
Skip it when
- You need audited, security‑certified cryptography.
- You require algorithms not provided (e.g., Argon2, RSA).
Strengths
- Pure Dart, no native dependencies
- Supports a wide range of hash functions and HMAC
- Works on all Flutter platforms
- Performance improvements in recent versions
Weaknesses
- Not reviewed by security professionals
- Limited to hashing/HMAC, no encryption or key management
- May lack the latest cryptographic primitives
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:crypto/crypto.dart';
import 'dart:convert';
void main() {
var bytes = utf8.encode('foobar');
var digest = sha1.convert(bytes);
print('Digest: $digest');
}Alternatives
Packages that do the same job and could replace crypto.
- webcrypto
Cross-platform implementation of Web Cryptography APIs for Dart.
89Compare - cryptography_flutter_plus
Flutter plugin to use platform APIs for package:cryptography_plus
73Compare - blockchain_utils
Comprehensive pure-Dart cryptography and blockchain toolkit with optional Rust backend.
72Compare - pqforge
Pure-Dart post-quantum cryptography for ML-KEM, ML-DSA, SLH-DSA, and HPKE.
71Compare
Works with
Packages commonly used together with crypto: ones it builds on, ones built on it, and its own family.
- analyzerBuilt on cryptoPerforms static analysis of Dart code for tool integration and embedding.
- uuidBuilt on cryptoGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- hooksBuilt on cryptoDart API for the JSON-based protocol for package build and link hooks.
- web_socket_channelBuilt on cryptoCross‑platform WebSocket channel wrapper for Dart
- dwdsBuilt on cryptoProxies between the Chrome debug protocol and the Dart VM service protocol.
- buildBuilt on cryptoPackage for authoring build_runner compatible code generators.
- build_runnerBuilt on cryptoA build system for Dart code generation and modular compilation.
- build_daemonBuilt on cryptoDaemon for running Dart builds in the background