Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

SHA256.HashData Method

Definition

Namespace:
System.Security.Cryptography
Assemblies:
netstandard.dll, System.Security.Cryptography.dll
Assemblies:
netstandard.dll, System.Security.Cryptography.Algorithms.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

NameDescription
HashData(Byte[])

Computes the hash of data using the SHA-256 algorithm.

HashData(Stream)

Computes the hash of a stream using the SHA-256 algorithm.

HashData(ReadOnlySpan<Byte>)

Computes the hash of data using the SHA-256 algorithm.

HashData(Stream, Span<Byte>)

Computes the hash of a stream using the SHA-256 algorithm.

HashData(ReadOnlySpan<Byte>, Span<Byte>)

Computes the hash of data using the SHA-256 algorithm.

HashData(Byte[])

Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs

Computes the hash of data using the SHA-256 algorithm.

public: static cli::array <System::Byte> ^ HashData(cli::array <System::Byte> ^ source);
public static byte[] HashData(byte[] source);
static member HashData : byte[] -> byte[]
Public Shared Function HashData (source As Byte()) As Byte()

Parameters

source
Byte[]

The data to hash.

Returns

The hash of the data.

Exceptions

source isnull.

Applies to

HashData(Stream)

Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs

Computes the hash of a stream using the SHA-256 algorithm.

public: static cli::array <System::Byte> ^ HashData(System::IO::Stream ^ source);
public static byte[] HashData(System.IO.Stream source);
static member HashData : System.IO.Stream -> byte[]
Public Shared Function HashData (source As Stream) As Byte()

Parameters

source
Stream

The stream to hash.

Returns

The hash of the data.

Exceptions

source isnull.

source does not support reading.

Applies to

HashData(ReadOnlySpan<Byte>)

Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs

Computes the hash of data using the SHA-256 algorithm.

public: static cli::array <System::Byte> ^ HashData(ReadOnlySpan<System::Byte> source);
public static byte[] HashData(ReadOnlySpan<byte> source);
static member HashData : ReadOnlySpan<byte> -> byte[]
Public Shared Function HashData (source As ReadOnlySpan(Of Byte)) As Byte()

Parameters

source
ReadOnlySpan<Byte>

The data to hash.

Returns

The hash of the data.

Applies to

HashData(Stream, Span<Byte>)

Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs

Computes the hash of a stream using the SHA-256 algorithm.

public: static int HashData(System::IO::Stream ^ source, Span<System::Byte> destination);
public static int HashData(System.IO.Stream source, Span<byte> destination);
static member HashData : System.IO.Stream * Span<byte> -> int
Public Shared Function HashData (source As Stream, destination As Span(Of Byte)) As Integer

Parameters

source
Stream

The stream to hash.

destination
Span<Byte>

The buffer to receive the hash value.

Returns

The total number of bytes written todestination.

Exceptions

source isnull.

The buffer indestination is too small to hold the calculated hash size. The SHA-256 algorithm always produces a 256-bit hash, or 32 bytes.

-or-

source does not support reading.

Applies to

HashData(ReadOnlySpan<Byte>, Span<Byte>)

Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs
Source:
SHA256.cs

Computes the hash of data using the SHA-256 algorithm.

public: static int HashData(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination);
public static int HashData(ReadOnlySpan<byte> source, Span<byte> destination);
static member HashData : ReadOnlySpan<byte> * Span<byte> -> int
Public Shared Function HashData (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte)) As Integer

Parameters

source
ReadOnlySpan<Byte>

The data to hash.

destination
Span<Byte>

The buffer to receive the hash value.

Returns

The total number of bytes written todestination.

Exceptions

The buffer indestination is too small to hold the calculated hash size. The SHA-256 algorithm always produces a 256-bit hash, or 32 bytes.

Applies to

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?