Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This example code shows how to encode and decode base64 and hexadecimal data in a WinUI app.
public void EncodeDecodeBase64()
{
// Define a Base64 encoded string.
String strBase64 = "uiwyeroiugfyqcajkds897945234==";
// Decoded the string from Base64 to binary.
IBuffer buffer = CryptographicBuffer.DecodeFromBase64String(strBase64);
// Encode the buffer back into a Base64 string.
String strBase64New = CryptographicBuffer.EncodeToBase64String(buffer);
}
public void EncodeDecodeHex()
{
// Define a hexadecimal string.
String strHex = "30310AFF";
// Decode a hexadecimal string to binary.
IBuffer buffer = CryptographicBuffer.DecodeFromHexString(strHex);
// Encode the buffer back into a hexadecimal string.
String strHexNew = CryptographicBuffer.EncodeToHexString(buffer);
}
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, see our contributor guide.
Windows developer