Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ComputeHash()

static string System.Net.Http.AuthenticationHelper.ComputeHash ( string data,
string algorithm )
inlinestaticprivate

Definition at line 599 of file AuthenticationHelper.cs.

600 {
601 using HashAlgorithm hashAlgorithm = (algorithm.StartsWith("SHA-256", StringComparison.OrdinalIgnoreCase) ? ((HashAlgorithm)SHA256.Create()) : ((HashAlgorithm)MD5.Create()));
602 Span<byte> span = stackalloc byte[hashAlgorithm.HashSize / 8];
603 int bytesWritten;
604 bool flag = hashAlgorithm.TryComputeHash(Encoding.UTF8.GetBytes(data), span, out bytesWritten);
606 }
static unsafe string ToString(ReadOnlySpan< byte > bytes, Casing casing=Casing.Upper)
static new SHA256 Create()
Definition SHA256.cs:55
static Encoding UTF8
Definition Encoding.cs:526

References System.Security.Cryptography.MD5.Create(), System.Security.Cryptography.SHA256.Create(), System.Security.Cryptography.HashAlgorithm, System.HexConverter.ToString(), and System.Text.Encoding.UTF8.

Referenced by System.Net.Http.AuthenticationHelper.GetDigestTokenForCredential().