Skip to content

Instantly share code, notes, and snippets.

@MrSchism
Last active August 29, 2015 14:17
Show Gist options
  • Save MrSchism/cef9e41dfb290e56b228 to your computer and use it in GitHub Desktop.
Save MrSchism/cef9e41dfb290e56b228 to your computer and use it in GitHub Desktop.
Powershell basis for Hashword 3 code base
# Algorithms and Encoding
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$utf8 = new-object -TypeName System.Text.UTF8Encoding
# Used variables
$alpha = 0
$num = 1
$dot = 3
$dash = 5
$at = 9
echo "`n Seed?"
$seed = read-host
$short = ([System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($seed))) -replace "-",'').tolower()
echo "-----`n"
$hashword = Switch($short -Split ''){
{$_ -match "\d" -and $num -ne $dot -and $num -ne $dash -and $num -ne $at}{$_;$num++;continue}
{$_ -match "\d" -and $num -eq $dot} {$_ + ".";$num++;continue}
{$_ -match "\d" -and $num -eq $dash} {$_ + "-";$num++;continue}
{$_ -match "\d" -and $num -eq $at} {$_ + "@";$num = 1;continue}
{$_ -match "[a-z]" -and $alpha -lt 3} {$_;$alpha++;continue}
{$_ -match "[a-z]"} {$alpha = 0;[char]::toupper($_)}
}
echo " hashword is #$($hashword -join '')"
@MrSchism
Copy link
Author

MrSchism commented Apr 3, 2015

Newest version of source includes caps and special characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment