你可以这样做:
# Get the hash of the file
$hash = Get-FileHash <path to input file> -Algorithm SHA512
# Convert hash to byte representation
$hashBytes = [System.Text.Encoding]::Unicode.GetBytes($hash.Hash)
# Convert bytes to base64, then output to file
[System.Convert]::ToBase64String($hashBytes) | Out-File <path to hash output file>
# Read encoded string from text file
$encodedHash = Get-Content <path to hash output file>
# Convert to from base64 to byte representation
$hashBytes = [System.Convert]::FromBase64String($encodedHash)
# Convert bytes to hash string
[System.Text.Encoding]::Unicode.GetString($hashBytes)
您可能可以将其中的一些步骤组合起来,但这将为您提供所需步骤的图片