document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # Code Snippet from aperturescience.su
  2. Function Test-bCryptHash
  3. {
  4. <#
  5. .SYNOPSIS
  6. Tests a plaintext string against a given hash value.
  7.  
  8. .DESCRIPTION
  9. This function tests an input plain text string against a specified hash value, return true if the bcrypt hash of the plaintext is
  10. equal to the hash specified.
  11.  
  12. We can do this as the output from get-salt includes the salt and workfactor information.
  13.  
  14. .PARAMETER PlainText
  15. Plain text to be hashed and compared to specifed has
  16.  
  17. .PARAMETER Hash
  18. Hash to be compared against
  19.  
  20. .INPUTS
  21. None
  22.  
  23. .OUTPUTS
  24. True if hash of plain text is equal to hash specified
  25.  
  26. .EXAMPLE
  27.  
  28. .EXAMPLE
  29.  
  30. .NOTES
  31. NAME: Test-BCryptHash
  32. LASTEDIT: 2012-11-17 11:15:00
  33. KEYWORDS: bcrypt, hash, password
  34.  
  35. .LINK
  36. http://bcrypt.codeplex.com/
  37.  
  38. .LINK
  39. http://aperturescience.su/
  40. #>
  41. [CMDLetBinding()]
  42. param
  43. (
  44.     [Parameter(mandatory=$true)] [String] $PlainText,
  45.     [Parameter(mandatory=$true)] [String] $Hash
  46. )
  47.  
  48. #call verify, specifing plaintext and the hash
  49. return [bcrypt.net.bcrypt]::verify($PlainText, $Hash)
  50.  
  51. }
  52.  
  53. # Code Snippet from aperturescience.su
');