CryptographicOperations.FixedTimeEquals Method
Definition
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.
Determines the equality of two byte sequences in an amount of time that depends on the length of the sequences, but not their values.
public:
static bool FixedTimeEquals(ReadOnlySpan<System::Byte> left, ReadOnlySpan<System::Byte> right);
public static bool FixedTimeEquals (ReadOnlySpan<byte> left, ReadOnlySpan<byte> right);
static member FixedTimeEquals : ReadOnlySpan<byte> * ReadOnlySpan<byte> -> bool
Public Shared Function FixedTimeEquals (left As ReadOnlySpan(Of Byte), right As ReadOnlySpan(Of Byte)) As Boolean
Parameters
- left
- ReadOnlySpan<Byte>
The first buffer to compare.
- right
- ReadOnlySpan<Byte>
The second buffer to compare.
Returns
true
if left
and right
have the same values for Length and the same contents; otherwise, false
.
Remarks
This method compares the contents from two buffers for equality in a way that doesn't leak timing information, making it ideal for use within cryptographic routines.
This method will short-circuit and return false
only if left
and right
have different lengths.
Fixed-time behavior is guaranteed in all other cases, including when left
and right
reference the same address.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기