I agree with all of Dangph Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-Output
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.
I agree with all of Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-Output
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.
I agree with all of Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-Output
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.
I agree with all of Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-HostOutput
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.
I agree with all of Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-Host
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.
I agree with all of Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-Output
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.
I agree with all of Dangph's points.
The .Net framework also has classes built-in to do hashing and then you can choose your algorithm. Check out the Validate-Thumbprint
function I wrote here to see how to enumerate the hash algorithms available on the system.
Regarding the last point about echo
, it's more than just unnecessary to use it. As mentioned, it's better to return the item to the pipeline, so that the caller of the function can decide what to do with it.
echo
is also an alias for Write-Host
and I'm of the belief that in re-usable code you should not use aliases, positional parameters, or parameter abbreviations.
You should also use [CmdletBinding()]
to define your function as an advanced function so that it supports common parameters and other goodies. You can add pipeline support then as well.
Consider the longer function definition format with a param()
block and define the type of each of your parameters, validation, etc.