Skip to content

No equivalent of Get-FileHash for text blobs, requires writing input to file to test output #3861

@dilijev

Description

@dilijev

Steps to reproduce

Try one of these to compare with test vector:
Write-Output "" | Get-FileHash -Algorithm SHA512
Get-FileHash -Algorithm SHA512 ""

Expected behavior

cmdlet for getting the hash of a blob without having to write to an intermediate file (does not need to be Get-FileHash, which would admittedly be confusing, but supporting input pipe would be nice and unambiguous.

Supporting this would be helpful for hashing generated text contents without necessarily having to write that file to disk.

Compare with shasum -a 512 -t "input-text" or empty-string input test vector (pipe from null) shasum -a 512 < /dev/null

Actual behavior

Unable to take the hash of anything other than a file.

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.15063.296
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.296
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions