Documentation ¶
Index ¶
Constants ¶
const ( // EntropyLow is the threshold below which the Shannon Entropy implies very little variation in the input EntropyLow = 0.5 // EntropyEnglishStart is the lower-bound for the Shannon Entropy of typical English Text. EntropyEnglishStart = 3.5 // EntropyEnglishEnd is the upper-bound for the Shannon Entropy of typical English Text. EntropyEnglishEnd = 5 // EntropyCompressed is the threshold above which the Shannon Entropy implies the data is random/encrypted/compressed. EntropyCompressed = 7.5 )
const IndexOfCoincidenceEnglish = float64(1.73) / 26
IndexOfCoincidenceEnglish is the expected Index of Coincidence for English text.
Variables ¶
This section is empty.
Functions ¶
func CaesarShift ¶
CaesarShift performs a caesar shift of the given amount on all a-z/A-Z characters. All other characters are left intact.
func CaesarShifts ¶
CaesarShifts performs all 25 possible caesar shifts on the input.
func IndexOfCoincidence ¶
IndexOfCoincidence calculates the Index of Coincidence of the given text. The IoC is a measure of how likely it is for two randomly-drawn letters to be identical.
Some sources include a normalising factor for comparing different alphabets. This is not included in this implementation, but can be trivially obtained by multiplying the result by 26.
func LetterDistribution ¶
LetterDistribution counts the number of the occurrences of each English letter (ignoring case).
func ShannonEntropy ¶
ShannonEntropy calculates the Shannon Entropy of the input. The Shannon Entropy is a measure of how much "information" is represented by the input.
Types ¶
This section is empty.