We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48075ca commit af30ceaCopy full SHA for af30cea
uniquepass.ps1
@@ -0,0 +1,36 @@
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
+}
0 commit comments