0
export default class Base64 {


atob(input: string = "") {
    let str = input.replace(/=+$/, "");
    let output = "";

if (str.length % 4 === 1) {
  throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");
}
for 
(
  let bc = 0, bs = 0, buffer, i = 0;
  // eslint-disable-next-line no-cond-assign
  (buffer = str.charAt(i++));
  ~buffer && ((bs = bc % 4 ? bs * 64 + buffer : buffer), bc++ % 4)
    ? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))
    : 0
) {
  buffer = chars.indexOf(buffer);
}

return output;

}

**I am facing an issue with this below line ** (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) : 0 )

I am unable to convert this line into c# for loop it

help me to convert this function into the c# function

Thank you!

0 Answers0