Powershell: Not supported on this platform error when running Get-StringHash with MD5 algorithm

Created on 15 Aug 2017  路  2Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

```Install Get-StringHash from PowerShell gallery (https://gallery.technet.microsoft.com/scriptcenter/Get-StringHash-aa843f71

Execute Get-StringHash ("admin", "MD5")


Expected behavior
-----------------

get-stringhash "admin" "MD5"
21232f297a57a5a743894a0e4a801fc3

This is what I get with PowerShell 5.1.16257.1. CLRVersion 4.0.30319.42000


Actual behavior
---------------

```get-stringhash "admin" "MD5"
Exception calling "Create" with "1" argument(s): "Operation is not supported on this
platform."
At line:5 char:1
+ [System.Security.Cryptography.HashAlgorithm]::Create($HashName).Compu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PlatformNotSupportedException

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.5
OS                             Microsoft Windows 10.0.16257
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Issue-Question Resolution-Answered

Most helpful comment

@peterquirk Thanks for your report!

Get-StringHash is not in the repo. Currently we have Get-FileHash and we are working on Get-Hash in #3395

The error "Operation is not supported on this platform." come from CoreFX. It is not PowerShell Core error. You should open issue in CoreFX repo.

All 2 comments

@peterquirk Thanks for your report!

Get-StringHash is not in the repo. Currently we have Get-FileHash and we are working on Get-Hash in #3395

The error "Operation is not supported on this platform." come from CoreFX. It is not PowerShell Core error. You should open issue in CoreFX repo.

Just to boil @iSazonov's statement down to an example that underscores his point:

# PS Core (direct use of a CoreFX type; CoreFX is the class library that comes with .NET Core)
PS> [System.Security.Cryptography.HashAlgorithm]::Create()
Exception calling "Create" with "0" argument(s): "Operation is not supported on this platform."
...
Was this page helpful?
0 / 5 - 0 ratings