File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function Hash($textToHash)
44 PowerShell function to generate/retrieve unique local administrator passwords.
55. DESCRIPTION
66 Takes an MD5 hash of a (optional) unique string, a hardcoded string, and the hostname in which
7- the function is run on.
7+ the function is run on.
88. NOTES
99 Author : jakx_
1010. EXAMPLE
@@ -14,23 +14,23 @@ function Hash($textToHash)
1414 $hostname = hostname
1515
1616 $s = " foobar"
17-
17+
1818 $new = " $hostname " + " $s " + " $texttoHash "
19-
20- $hashme = new-object System.Security.Cryptography.MD5CryptoServiceProvider
2119
22- $tohash = [System.Text.Encoding ]::UTF8.GetBytes($new )
20+ $hashme = new-object System.Security.Cryptography.MD5CryptoServiceProvider
21+
22+ $tohash = [System.Text.Encoding ]::UTF8.GetBytes($new )
2323
24- $ByteArray = $hashme.ComputeHash ($tohash )
24+ $ByteArray = $hashme.ComputeHash ($tohash )
2525
26- foreach ($byte in $ByteArray )
26+ foreach ($byte in $ByteArray )
2727
28- {
28+ {
2929
30- $pass += $byte.ToString ()
30+ $pass += $byte.ToString ()
3131
32- }
32+ }
3333
34- return $pass ;
34+ return $pass ;
3535
36- }
36+ }
You can’t perform that action at this time.
0 commit comments