Adam W. McKinley
Adam W. McKinley

Reputation: 775

Why Would One Use the Unmanaged Implementation of a System.Security.Cryptography Hash?

For example, Microsoft provides both SHA1Managed and SHA1CryptoServiceProvider (Unmanaged) as implementations of SHA1.

What, if any, are the advantages and disadvantages of using the unmanaged implementation instead of the managed implementation?

Thanks for any help!

Update:

The answers from SLaks, Chochos, and fejesjoco were very useful, but I chose SLaks because he asked me to. :-)

As a summary, choose:

Upvotes: 0

Views: 209

Answers (3)

Chochos
Chochos

Reputation: 5159

If you have a hardware cryptographic accelerator, you'll need to use an unmanaged implementation to access it, since the managed implementatios won't use it.

Upvotes: 1

fejesjoco
fejesjoco

Reputation: 11903

I'd assume the managed implementation is guaranteed to be platform independent.

Upvotes: 0

SLaks
SLaks

Reputation: 887469

The CSP implementation is FIPS-certified.

If FIPS is enabled in Local Security Policy, the *Managed classes will throw an exception.

Upvotes: 4

Related Questions