mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2025-01-25 08:13:00 +00:00
46 lines
1.6 KiB
PowerShell
46 lines
1.6 KiB
PowerShell
|
Describe "ConvertTo-LMHash" {
|
|||
|
Context "When the input is a unicode string" {
|
|||
|
$input = ConvertTo-SecureString '<27>lu<6C>ou<6F>k<EFBFBD> k<><6B>' -AsPlainText -Force
|
|||
|
$expected = "AAD3B435B51404EEAAD3B435B51404EE"
|
|||
|
$actual = ConvertTo-LMHash $input
|
|||
|
|
|||
|
It "should return the correct hash" {
|
|||
|
$actual | Should Be $expected
|
|||
|
}
|
|||
|
}
|
|||
|
Context "When the input is an ASCII string" {
|
|||
|
$input = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force
|
|||
|
$expected = "727E3576618FA1754A3B108F3FA6CB6D"
|
|||
|
$actual = ConvertTo-LMHash $input
|
|||
|
|
|||
|
It "should return the correct hash" {
|
|||
|
$actual | Should Be $expected
|
|||
|
}
|
|||
|
}
|
|||
|
Context "When the input comes from the pipeline" {
|
|||
|
$input1 = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force
|
|||
|
$input2 = ConvertTo-SecureString 'test' -AsPlainText -Force
|
|||
|
$expected = "727E3576618FA1754A3B108F3FA6CB6D","01FC5A6BE7BC6929AAD3B435B51404EE"
|
|||
|
$actual = $input1,$input2 | ConvertTo-LMHash
|
|||
|
|
|||
|
It "should return multiple hashes" {
|
|||
|
$actual | Should Be $expected
|
|||
|
}
|
|||
|
}
|
|||
|
Context "When the input is an empty string" {
|
|||
|
$input = New-Object SecureString
|
|||
|
$expected = "AAD3B435B51404EEAAD3B435B51404EE"
|
|||
|
$actual = ConvertTo-LMHash $input
|
|||
|
|
|||
|
It "should return the correct hash" {
|
|||
|
$actual | Should Be $expected
|
|||
|
}
|
|||
|
}
|
|||
|
Context "When the input is a long string" {
|
|||
|
$input = ConvertTo-SecureString 'EHB3xUAY2NZIp9wI7khNWGWyOiuhyK' -AsPlainText -Force
|
|||
|
|
|||
|
It "should throw an exception" {
|
|||
|
{ ConvertTo-LMHash $input } | Should Throw
|
|||
|
}
|
|||
|
}
|
|||
|
}
|