ntcdcrypto 0.0.4

  • Readme
  • Changelog
  • Installing
  • new48

ntc_dcrypto #

ntc_dcrypto is module dart cryptography.

Use this package as a library #

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

dependencies:
  ntcdcrypto: ^0.0.4

1. An implementation of Shamir's Secret Sharing Algorithm 256-bits in Dart #

Usage #

Use encode/decode Hex

import 'package:ntcdcrypto/ntcdcrypto.dart';

main() {
  SSS sss = new SSS();
  String s = "nghiatcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  print("secret: ${s}");
  print("secret.length: ${s.length}");
  // creates a set of shares
  List<String> arr = sss.create(3, 6, s);
  //print(arr);

  // combines shares into secret
  var s1 = sss.combine(arr.sublist(0, 3));
  print("combines shares 1 length = ${arr.sublist(0, 3).length}");
  print("secret: ${s1}");
  print("secret.length: ${s1.length}");

  var s2 = sss.combine(arr.sublist(3, arr.length));
  print("combines shares 2 length = ${arr.sublist(3, arr.length).length}");
  print("secret: ${s2}");
  print("secret.length: ${s2.length}");

  var s3 = sss.combine(arr.sublist(1, 5));
  print("combines shares 3 length = ${arr.sublist(1, 5).length}");
  print("secret: ${s3}");
  print("secret.length: ${s3.length}");
}

License #

This code is under the Apache Licence v2.

[0.0.1] - Mar 16, 2020. #

  • First release. See file README.md.

[0.0.2] - Mar 16, 2020. #

  • Update and clean code.

[0.0.3] - Mar 23, 2020. #

  • Update code isValidShareHex.

[0.0.4] - Mar 23, 2020. #

  • Update code isValidShareHex.

Use this package as a library

1. Depend on it

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


dependencies:
  ntcdcrypto: ^0.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:ntcdcrypto/ntcdcrypto.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
13
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Mar 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/main.dart. (-1.99 points)

Analysis of lib/main.dart reported 4 hints:

line 68 col 18: Avoid using braces in interpolation when not needed.

line 77 col 18: Avoid using braces in interpolation when not needed.

line 82 col 18: Avoid using braces in interpolation when not needed.

line 87 col 18: Avoid using braces in interpolation when not needed.

Fix lib/ntcdcrypto.dart. (-0.50 points)

Analysis of lib/ntcdcrypto.dart reported 1 hint:

line 16 col 1: Prefer using /// for doc comments.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and ntcdcrypto.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
hex ^0.1.2 0.1.2
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test