Skip to content

Files

Latest commit

69bf0bc · Feb 4, 2023

History

History

dargon2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 20, 2022
Jul 8, 2022
Oct 8, 2022
Jan 20, 2022
Jan 20, 2022
Jul 8, 2022
Jan 20, 2022
Jan 26, 2022
Jan 20, 2022
Jan 20, 2022
Mar 17, 2022
Feb 4, 2023
Jul 8, 2022

dargon2

dargon2 pub package License: MIT

Dart bindings for the reference C implementation of Argon2, the winner of the Password Hash Competition.

This plugin is ONLY for native dart implementations. For Flutter, please use dargon2_flutter

Usage

High-level hashing and verification (for direct hashing & verification of byte arrays, check the example)

import 'package:dargon2/dargon2.dart';

void main() async {
   var password = 'password';
   //use Salt(List<int> bytes) for a salt from an Integer list
   var s = Salt.newSalt();
   //Hash with pre-set params (iterations: 32, memory: 256, parallelism: 2, 
   //length: 32, type: Argon2Type.i, version: Argon2Version.V13)
   var result = await argon2.hashPasswordString(password, salt: s);
   
   //Raw hash values available as int list, base 64 string, and hex string
   var bytesRaw = result.rawBytes;
   var base64Hash = result.base64String;
   var hexHash = result.hexString;
   
   //Encoded hash values available as int list and encoded string
   var bytesEncoded = result.encodedBytes;
   var stringEncoded = result.encodedString;
   
   //Verify password (returns true/false), uses default type (Argon2Type.i)
   var verified = await argon2.verifyHashString(password, stringEncoded);
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Please mark all dargon2 issues with [dargon2] prepended to the issue title

Licensing