This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-PathShortener { | |
<# | |
.SYNOPSIS | |
Path Shortener | |
.NOTES | |
Author: Øyvind Kallstad | |
Date: 05.04.2016 | |
Version: 2 | |
#> | |
[CmdletBinding()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-PackageUpdate { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string] $Name, | |
[Parameter()] | |
[string] $ProviderName | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([Parameter(Position = 0)][string] $Path = 'C:\Users\grave\Downloads\ChessData-master\') | |
$code = @{ | |
Name = 'ResultCounter' | |
Namespace = 'ChessData' | |
PassThru = $true | |
UsingNamespace = @( | |
'System.Collections.Concurrent', | |
'System.IO', | |
'System.Threading.Tasks' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-Digits { | |
<# | |
.SYNOPSIS | |
Convert an integer into an array of bytes of its individual digits. | |
.DESCRIPTION | |
Convert an integer into an array of bytes of its individual digits. | |
.EXAMPLE | |
ConvertTo-Digits 145 | |
.INPUTS | |
System.UInt64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-LuhnChecksum { | |
<# | |
.SYNOPSIS | |
Calculate the Luhn checksum of a number. | |
.DESCRIPTION | |
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, | |
is a simple checksum formula used to validate a variety of identification numbers, such as | |
credit card numbers, IMEI numbers, National Provider Identifier numbers in the US, and | |
Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn. | |
.EXAMPLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-RepeatingKeyXOR { | |
# http://cryptopals.com/sets/1/challenges/5/ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] | |
[ValidateNotNullOrEmpty()] | |
[Alias('String')] | |
[string] $InputString, | |
[Parameter(Mandatory = $true, Position = 1)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-Bytes { | |
<# | |
.SYNOPSIS | |
Convert a string to bytes. | |
.NOTES | |
Author: Øyvind Kallstad | |
Date: 13.02.2016 | |
Version: 1.0 | |
#> | |
[CmdletBinding()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Entropy { | |
<# | |
.SYNOPSIS | |
Calculate the entropy of a data set. | |
.DESCRIPTION | |
This function will calculate either the Shannon Entropy, or the | |
Metric Entropy of a data set. | |
.EXAMPLE | |
Get-Entropy -InputObject $myArray | |
Calculate the Shannon Entropy in the data in the myArray array. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Remove-Characters { | |
<# | |
.SYNOPSIS | |
Remove characters from a string. | |
.DESCRIPTION | |
This function will take an array of characters, and will remove | |
those characters from the input string. | |
.EXAMPLE | |
$myString | Remove-Characters | |
This will remove all 'default' characters from myString. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Measure-Frequency { | |
<# | |
.SYNOPSIS | |
Get the frequency distribution of a set. | |
.DESCRIPTION | |
This function will get the frequency distribution of a set (array) of data. | |
It supports array types, as well as strings. | |
.EXAMPLE | |
Measure-Frequency $array | |
.EXAMPLE |