password 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 88

password

Pub Package Build Status Donate

A set of high-level APIs over PointyCastle to hash and verify passwords securely.<br> Heavily inspired on PHP's Password Hashing Functions.

Looking for two-way cryptography (encryption+decryption)? Please, visit encrypt.

API

Password.hash

Password.hash('password', new PBKDF2());
// $pcks$64,10000,64$530f8afbc74536b9a963b4f1c4cb738bcea7403d4d606b6e074ec5d3baf39d18$56158864e365bd78f6afda27f9a239bcb3f2b7a4773d4c0d0858c86266119d1e35aae9ca1a4777ed3d85c42caeed0c57cc7e09fe7d152d5d4d4ee08506c2b41a

Password.verify

Password.verify('password', previousOutput);
// true

Password.verify('secret', previousOutput);
// false

Defaults

In almost cases, you should rely on default PRNG for salts. It is cryptographically secure and unique for each password.

On the other hand, you are encouraged to change interations count for what your hardware can handle.

PBKDF2

DigestSHA-512
Block size64 bytes
Salt32 bytes Fortuna
Iteration count10000
Key length64 bytes

Waiting for Argon2.

1.0.0

  • Stable and documented API.

example/main.dart

import 'package:password/password.dart';

void main() {
  final password = 'secret';
  final algorithm = PBKDF2();
  final hash = Password.hash(password, algorithm);

  print(hash);
  print(Password.verify(password, hash));
  print(Password.verify('wrongpass', hash));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  password: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:password/password.dart';
  
Version Uploaded Documentation Archive
1.0.0 Dec 17, 2018 Go to the documentation of password 1.0.0 Download password 1.0.0 archive
0.1.1+2 Jul 23, 2018 Go to the documentation of password 0.1.1+2 Download password 0.1.1+2 archive
0.1.1+1 Jun 2, 2018 Go to the documentation of password 0.1.1+1 Download password 0.1.1+1 archive
0.1.1 Jun 2, 2018 Go to the documentation of password 0.1.1 Download password 0.1.1 archive
0.1.0 Jun 2, 2018 Go to the documentation of password 0.1.0 Download password 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Dec 17, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:password/password.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
pointycastle ^1.0.0 1.0.0
Dev dependencies
test ^1.5.1+1