Re:300M Freely Downloadable Pwned Passwords
by Spivak on Thursday August 03, 2017 @04:15PM
(#14923390)
And people say that PowerShell isn't readable or intuitive.
Re:300M Freely Downloadable Pwned Passwords
by 13of40 on Thursday August 03, 2017 @05:27PM
(#14924048)
You can also do it like this:
"foobar" | Out-File password.txt -Encoding ASCII -NoNewline
Get-FileHash password.txt -Algorithm SHA1
del password.txt
That's readable and intuitive, but the downside is it puts your password in a file.
$password = "foobar"
([Security.Cryptography.SHA1CryptoServiceProvider]::Create().ComputeHash([Text.Encoding]::ASCII.GetBytes($password)) | %{'{0:x2}' -f $_}) -join ""