HMACSHA256 Constructor (Byte())
Initializes a new instance of the HMACSHA256 class with the specified key data.
Assembly: mscorlib (in mscorlib.dll)
HMACSHA256 is a type of keyed hash algorithm that is constructed from the SHA-256 hash function and used as a Hash-based Message Authentication Code (HMAC). The HMAC process mixes a secret key with the message data, hashes the result with the hash function, mixes that hash value with the secret key again, and then applies the hash function a second time. The output hash is 256 bits in length.
' Initialize the keyed hash object. Dim myhmacsha256 As New HMACSHA256(key) Dim inStream As IsolatedStorageFileStream = isoStore.OpenFile(sourceFilePath, FileMode.Open) inStream.Position = 0 ' Compute the hash of the input file. Dim hashValue As Byte() = myhmacsha256.ComputeHash(inStream) ' Reset inStream to the beginning of the file. inStream.Position = 0 ' Write the computed hash value to the output file. outStream.Write(hashValue, 0, hashValue.Length) ' Copy the contents of the sourceFile to the destFile. Dim bytesRead As Integer ' read 1K at a time Dim buffer(1023) As Byte Do ' Read from the wrapping CryptoStream. bytesRead = inStream.Read(buffer, 0, 1024) outStream.Write(buffer, 0, bytesRead) Loop While bytesRead > 0 myhmacsha256.Clear()
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.