Skip to content
This repository was archived by the owner on Nov 13, 2022. It is now read-only.

Commit b52e36e

Browse files
author
K
committed
Adding hashtester
1 parent 281e743 commit b52e36e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Modules/HashTester/Hashtester.psm1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function hashTester($runs){
2+
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
3+
$sha = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider
4+
$utf8 = new-object -TypeName System.Text.UTF8Encoding
5+
$md5Queue = new-object System.Collections.Generic.List[String]
6+
$shaQueue = new-object System.Collections.Generic.List[String]
7+
runHash $md5 $md5Queue $runs;
8+
runHash $sha $shaQueue $runs;
9+
"SHA1"
10+
$shaQueue | group-object | FT -a -p Name,Count
11+
"MD5"
12+
$md5Queue | group-object | FT -a -p Name,Count
13+
}
14+
15+
function runHash($alg,$col,$runs)
16+
{
17+
for($i = 0; $i -lt 10000; $i++)
18+
{
19+
$server = "WDDCEPSCDWEB" + $i;
20+
21+
$col.Add([System.BitConverter]::ToUInt64($alg.ComputeHash($utf8.GetBytes($server)),2) % $runs);
22+
23+
}
24+
25+
}

0 commit comments

Comments
 (0)