Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the main problem in your code is that you are trying to compare cabbages with carrots (French expression):</p> <p>Convert.FromBase64String and ASCIIEncoding().GetBytes don't do the same thing at all.</p> <p>Just try to use any text file as an input to your program and it will fail on FromBase64 while running fine with ASCIIEncoding.</p> <p>Now for the explanation on the performance hit:</p> <ul> <li><p>ASCIIEncoding().GetBytes is just taking one character from your file and converting it into a byte (which is rather straight forward: there is nothing to do). For instance, it will translate 'A' into 0x41 and 'Z' into 0x5A...</p></li> <li><p>For Convert.FromBase64String, it is another story. It is really translating a "base64 encoded string" into an array of bytes. A base64 string is a - let's say - "printable representation of binary data. Better, it is a "text" representation of binary data that allows it to be, for instance, sent over an internet wire. Images in mails are base64 encoded because the mail protocols are text based. So the process of converting back/forth base64 to bytes is not straightforward at all; thus the performance hit.</p></li> </ul> <p>Fyi, a base64 string should look something like that: </p> <p>SABlAGwAbABvAHcAIABXAG8AcgBsAGQAIQA=</p> <p>which translates to "Hello World!" not immediate, isn't it?</p> <p>Here is some info about the base64 format: <a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Base64</a></p> <p>Hope this helps</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload