File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ function Hash ($textToHash )
2
+ <#
3
+ . SYNOPSIS
4
+ PowerShell function to generate/retrieve unique local administrator passwords.
5
+ . DESCRIPTION
6
+ Takes an MD5 hash of a (optional) unique string, a hardcoded string, and the hostname in which
7
+ the function is run on.
8
+ . NOTES
9
+ Author : jakx_
10
+ . EXAMPLE
11
+ hash testing
12
+ #>
13
+ {
14
+ $hostname = hostname
15
+
16
+ $s = " foobar"
17
+
18
+ $new = " $hostname " + " $s " + " $texttoHash "
19
+
20
+ $hashme = new-object System.Security.Cryptography.MD5CryptoServiceProvider
21
+
22
+ $tohash = [System.Text.Encoding ]::UTF8.GetBytes($new )
23
+
24
+ $ByteArray = $hashme.ComputeHash ($tohash )
25
+
26
+ foreach ($byte in $ByteArray )
27
+
28
+ {
29
+
30
+ $pass += $byte.ToString ()
31
+
32
+ }
33
+
34
+ return $pass ;
35
+
36
+ }
You can’t perform that action at this time.
0 commit comments