kjacobsen

bcrypt powershell examples

Jan 27th, 2013
5,024
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Add the BCrypt Types/Classes (here I am using Bcrypt from Chocolatey)
  2. Add-Type -Path C:\Chocolatey\lib\BCrypt.Net.0.1.0\lib\net35\BCrypt.Net.dll
  3. # Import our module
  4. Import-Module .\BCrypt.psm1
  5. # Set a workfactor
  6. $workfactor = 10
  7. # Create a hash of alice's password
  8. $alicehash = Get-BCryptHash -InputString "My Password" -WorkFactor $workfactor
  9. # display the password
  10. $alicehash
  11. # test the plain text "Evil Hacker" against the hash, will return false
  12. Test-bCryptHash -PlainText "Evil hacker" -Hash $alicehash
  13. # test the plain text "My Password" against the hash, will return true
  14. Test-bCryptHash -PlainText "My Password" -Hash $alicehash
  15.  
  16. # Code Snippet from aperturescience.su
Advertisement
Add Comment
Please, Sign In to add comment