entropy

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package entropy contains functions for checking the entropy of given data

Index

Examples

Constants

View Source
const (
	Base64Threshold = 4.5
	HexThreshold    = 3.0
)

Define entropy thresholds over which a string is considered complex enough to be a potential key

Variables

This section is empty.

Functions

func CalculateShannon

func CalculateShannon(data []byte) float64

CalculateShannon calculates the shannon entropy for a block of data - http://blog.dkbza.org/2007/05/scanning-data-for-entropy-anomalies.html

Example
package main

import (
	"fmt"

	"github.com/ONSdigital/git-diff-check/entropy"
)

func main() {
	password := []byte("verysecret")
	if entropy.CalculateShannon(password) < entropy.Base64Threshold {
		fmt.Println("Password not complex enough!")
	}
}

func Check

func Check(b []byte) (bool, int)

Check searches through a given block of data to attempt to identify high entropy blocks. Returns true and number of matching strings if found

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL