Skip to content
pubscout

argon2

1.0.1, released 5 years ago by an unverified publisher

Pure Dart Argon2 algorithm for password hashing across all platforms.

WASM-readyUnverified publisher
$ flutter pub add argon2
Source repository

What it does

Provides a pure Dart implementation of the Argon2 password hashing algorithm, allowing developers to generate cryptographic keys and hashes from passwords and salts on all Dart platforms including JS/Web, Flutter, and VM/Native.

AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to securely hash passwords using the Argon2 algorithm in a pure Dart environment.
  • Your application targets multiple platforms including Web, Native, and Flutter.

Skip it when

  • You only need standard hashing algorithms like SHA or MD5 already covered by the crypto package.
  • You prefer platform-specific native implementations for performance reasons.

Strengths

  • Pure Dart implementation works across all platforms (JS/Web, Flutter, VM/Native).
  • Implements the winner of the Password Hash Competition 2015.

Weaknesses

  • Pure Dart implementations of heavy crypto algorithms may be slower than native C bindings.
  • Limited documentation beyond the basic README example.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
import 'dart:typed_data';
import 'package:argon2/argon2.dart';

void main() {
  var password = 'pass123456';
  var salt = 'somesalt'.toBytesLatin1();
  var parameters = Argon2Parameters(
    Argon2Parameters.ARGON2_i,
    salt,
    version: Argon2Parameters.ARGON2_VERSION_10,
    iterations: 2,
    memoryPowerOf2: 16,
  );
  var argon2 = Argon2BytesGenerator();
  argon2.init(parameters);
  var passwordBytes = parameters.converter.convert(password);
  var result = Uint8List(32);
  argon2.generateBytes(passwordBytes, result, 0, result.length);
  var resultHex = result.toHexString();
  print('Result: $resultHex');
}

Alternatives

Packages that do the same job and could replace argon2.

  • crypto

    If you need standard cryptographic hash functions like SHA, MD5, or HMAC built for Dart.

Works with

Packages commonly used together with argon2: ones it builds on, ones built on it, and its own family.