document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # Code Snippet from aperturescience.su
  2. Function Get-BCryptSalt
  3. {
  4. <#
  5. .SYNOPSIS
  6. Gets a bcrypt salt
  7.  
  8. .DESCRIPTION
  9. This cmdlet will return a valid bcrypt salt, either from the default workfactor for the bcrypt.net library or using the specified work fector.
  10.  
  11. .PARAMETER WorkFactor
  12. [Optional] Optial specification of a work factor, mut be between 4 and 32.
  13.  
  14. .INPUTS
  15. Takes no pipeline input
  16.  
  17. .OUTPUTS
  18. String representation of bycrypt salt
  19.  
  20. .EXAMPLE
  21. $salt = Get-Salt
  22. Returns a salt sing the bcrypt.net default work factor (10?)
  23.  
  24. .EXAMPLE
  25. $hardsalt = Get-Salt -WorkFactor 30
  26. Returns a salt which has a work factor of 30, or 2^30 amount of work to be performed whenever it is used
  27.  
  28. .NOTES
  29. NAME: Get-BCryptSalt
  30. LASTEDIT: 2012-11-17 11:15:00
  31. KEYWORDS: bcrypt, hash, password
  32.  
  33. .LINK
  34. http://bcrypt.codeplex.com/
  35.  
  36. .LINK
  37. http://aperturescience.su/
  38. #>
  39. [CMDLetBinding()]
  40. param
  41. (
  42.     [int] $WorkFactor
  43. )
  44.  
  45. #if a work factor is specified, then use the generate salt function which takes a work factor
  46. if ($WorkFactor)
  47. {
  48.     return [bcrypt.net.bcrypt]::generatesalt($WorkFactor)
  49. }
  50. else
  51. {
  52.     return [bcrypt.net.bcrypt]::generatesalt()
  53. }
  54.  
  55. }
  56. # Code Snippet from aperturescience.su
');