dbcrypt 1.0.0

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

DBCrypt

Port of jBCrypt to Dart.

This system hashes passwords using a version of Bruce Schneier's Blowfish block cipher with modifications designed to raise the cost of off-line password cracking. The computation cost of the algorithm is parameterised, so it can be increased as computers and Dart VM get faster.

Build Status

Installation

Add to your pubspec.yaml the following:

dependencies:
  dbcrypt: ^1.0.0

Usage

Hashing a password is easy:

import 'package:dbcrypt/dbcrypt.dart'

main() {
  var plainPassword = "P@55w0rd";
  var hashedPassword = new DBCrypt().hashpw(plainPassword, new DBCrypt().gensalt());
}

Comparing a plain and a hashed password is even easier:

var isCorrect = new DBCrypt().checkpw(plain, hashed);

Running Tests

Dependencies are installed using the Pub Package Manager.

# For running the tests it needs the 'dart' executable on your path. 
# Execute the next command if it isn't already on your path:
export DART_SDK=path/to/dart/sdk

pub install

test/run.sh

1.0.0

  • Upgrade to Dart 2
  • Add support for $2y$ and $2b$ versions of BCrypt
  • Password are now generated with $2b$ since this lib doesn't have the OpenBSD $2a$ version bug

0.2.0

  • Upgrade to Dart 1

example/example.dart

import 'package:dbcrypt/dbcrypt.dart';

void main() {
  DBCrypt dBCrypt = DBCrypt();
  const plainPwd = "mySuperSecretP@ssw0rd";
  // Hash password with default values
  String hashedPwd = dBCrypt.hashpw(plainPwd, dBCrypt.gensalt());

  // Check the plain password against the hashed password
  assert(dBCrypt.checkpw(plainPwd, hashedPwd), true);

  // Generate a salt with a cost of 12 and hash the password with it
  String salt = dBCrypt.gensaltWithRounds(12);
  hashedPwd = dBCrypt.hashpw(plainPwd, salt);

  // Check the plain password against the 12-cost hashed password
  assert(dBCrypt.checkpw(plainPwd, hashedPwd), true);
}

Use this package as a library

1. Depend on it

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


dependencies:
  dbcrypt: ^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:dbcrypt/dbcrypt.dart';
  
Version Uploaded Documentation Archive
1.0.0 Aug 2, 2018 Go to the documentation of dbcrypt 1.0.0 Download dbcrypt 1.0.0 archive
0.2.1 Dec 7, 2013 Go to the documentation of dbcrypt 0.2.1 Download dbcrypt 0.2.1 archive
0.2.0 Nov 7, 2013 Go to the documentation of dbcrypt 0.2.0 Download dbcrypt 0.2.0 archive
0.1.3+2 May 4, 2013 Go to the documentation of dbcrypt 0.1.3+2 Download dbcrypt 0.1.3+2 archive
0.1.3+1 Apr 11, 2013 Go to the documentation of dbcrypt 0.1.3+1 Download dbcrypt 0.1.3+1 archive
0.1.3 Apr 4, 2013 Go to the documentation of dbcrypt 0.1.3 Download dbcrypt 0.1.3 archive
0.1.2 Mar 9, 2013 Go to the documentation of dbcrypt 0.1.2 Download dbcrypt 0.1.2 archive
0.1.1 Feb 21, 2013 Go to the documentation of dbcrypt 0.1.1 Download dbcrypt 0.1.1 archive
0.1.0 Jan 26, 2013 Go to the documentation of dbcrypt 0.1.0 Download dbcrypt 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
81
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]
90
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

The description is too long.

Search engines will display only the first part of the description. Try to keep it under 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.0 <3.0.0
Dev dependencies
benchmark_harness >=1.0.2 <2.0.0
test ^1.3.0