SHA-512 Hash using C#

Introduction

SHA-2, also known as Secure Hash Algorithm 2, is a set of cryptographic hash functions. SHA-512 now discussing after SHA-1 Hash. It is widely used in security applications and protocols like TLS and SSL, PGP, SSH, S/MIME, and IPsec. It is used for verifying transactions and determining proof of stake or proof of work in several cryptocurrencies like Bitcoin. SHA-2 is a secure hash algorithm that is used for legal proposes in certain U.S. Government application such as protection of sensitive unclassified information. In our earlier discussion, also discussed about very important terms of security and performance like security (Content Security Policy) and MVC security like How to Prevent Direct URL Access In MVC, Prevent Cross-Site Request Forgery using AntiForgeryToken() in MVC.

You can use SHA-512 hash as a unique vale of fixed size. It represents a large amount of data. In order to match hashes of two sets of data should match, only when the corresponding data also matches. Your small changes to the data will cause impulsive changes in the hash. The hash size for the SHA512 algorithm is 512 bits. This is an abstract class and the only implementation of this class is SHA512 Managed.

Working Sample

In this example, SHA512 hash is computed for data and stores in its result. This example presumes that there is a predefined constant DATA_SIZE.