Last active
August 29, 2015 14:17
-
-
Save MrSchism/cef9e41dfb290e56b228 to your computer and use it in GitHub Desktop.
Powershell basis for Hashword 3 code base
This file contains 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
# 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 '')" |
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
This might be a good start.
Current result is that it separates the hashword into a character array and evaluates each character to determine if it's a letter or number. It then capitalizes every fourth letter.
To do: rejoin the array as a variable while maintaining the capitalization (which, for some reason, it doesn't do)
Possible solution: on like 36, throw $n to a string and join the strings?