Vergleichen von Puffern
Dieser Beispielcode zeigt, wie Sie Puffer in einer App für die universelle Windows-Plattform (UWP) vergleichen.
public void CompareBuffers()
{
// Create a hexadecimal string.
String strHex = "30310aff";
// Create a Base64 string that is equivalent to strHex.
String strBase64v1 = "MDEK/w==";
// Create a Base64 string that is not equivalent to strHex.
String strBase64v2 = "KEDM/w==";
// Decode strHex to a buffer.
IBuffer buff1 = CryptographicBuffer.DecodeFromHexString(strHex);
// Decode strBase64v1 to a buffer.
IBuffer buff2 = CryptographicBuffer.DecodeFromBase64String(strBase64v1);
// Decode strBase64v2 to a buffer.
IBuffer buff3 = CryptographicBuffer.DecodeFromBase64String(strBase64v2);
// Compare the hexadecimal-decoded buff1 to the Base64-decoded buff2.
// The code points in the two buffers are equal, and the Boolean value
// is true.
Boolean bVal_1 = CryptographicBuffer.Compare(buff1, buff2);
// Compare the hexadecimal-decoded buff1 to the Base64-decoded buff3.
// The code points in the two buffers are not equal, and the Boolean value
// is false.
Boolean bVal_2 = CryptographicBuffer.Compare(buff1, buff3);
}
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für