Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An entropy calculator in Dart.
Dart
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.md
pubspec.yaml

README.md

Entropy

An entropy calculator in Dart.

Installation

Add as a dependency to your pubspec.yaml. For example:

dependencies:
  entropy:
    git: git://github.com/kaisellgren/entropy.git

Later on it will be available on the official pub repository.

Example

import 'package:entropy/entropy.dart';

void main() {
  var data = "The quick brown fox jumps over the lazy dog.";

  print(Entropy.calculate(data)); // 4.4877296299517635 bits of entropy.
}

Optimal is 8-bits of entropy per byte.

Use scenarios

This can be used for various purposes including:

  • Finding out if a file is compressible. A low entropy level hints that compressing the file yields barely any improvement on size.
  • Determining strength of a password to a certain extent.

License

The library is licensed under MIT. Feel free to use it for any purpose.

Something went wrong with that request. Please try again.