crypt 1.0.3 copy "crypt: ^1.0.3" to clipboard
crypt: ^1.0.3 copied to clipboard

outdatedDart 1 only

One-way string hashing for salted passwords using the Unix crypt format

example/crypt.dart

// Copyright (c) 2015, 2016, Hoylen Sue. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library crypt.example;

import 'package:crypt/crypt.dart';

main() {
  var c1 = new Crypt.sha256("p@ssw0rd"); // default rounds, random salt
  var c2 = new Crypt.sha256("p@ssw0rd", rounds: 10000); // random salt
  var c3 = new Crypt.sha256("p@ssw0rd", salt: "abcdefghijklmnop"); // default rounds
  var c4 = new Crypt.sha256("p@ssw0rd", rounds: 10000, salt:"abcdefghijklmnop");

  print(c1.toString());
  print(c2.toString());
  print(c3.toString());
  print(c4.toString());

  var suppliedValue = "p@ssw0rd";
  if (c1.match(suppliedValue)) {
    print("Correct value match");
  } else {
    print("Error: unexpected non-match: $suppliedValue");
  }

  suppliedValue = "123456";
  if (c1.match(suppliedValue)) {
    print("Error: unexpected match: $suppliedValue");
  } else {
    print("Incorrect value does not match");
  }
}
36
likes
0
pub points
95%
popularity

Publisher

verified publisherhoylen.com

One-way string hashing for salted passwords using the Unix crypt format

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crypto

More

Packages that depend on crypt