how to decode a base 64 encoded string encoded using Base64Encode with ATL_BASE64_FLAG_NOPAD flag.
how to decode a base 64 encoded string encoded using Base64Encode with ATL_BASE64_FLAG_NOPAD flag.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that just means “don’t put the
=at the end” you can add the padding directly:(The way base64 works, you should never end up with an unpadded value with a final block of 1 character.)
After adding the padding, just use
Convert.FromBase64Stringas usual.EDIT: As noted in comments, if your base64 string contains whitespace, you should remove that first before adding the padding. A simple
text = Regex.Replace(text, @"\s", "")should do the trick.