Re: Base64 question
- From: "Jim Brandley" <Jim.Brandley@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 7 Jul 2007 21:25:48 -0500
I'll try that and see what it costs. I was hoping to avoid another iteration
through the characters in the string.
"Arne Vajhøj" <arne@xxxxxxxxxx> wrote in message
news:46904a3e$0$90266$14726298@xxxxxxxxxxxxxxxxxx
Jim Brandley wrote:
I need to append a short ciphertext string as a query variable encoded so
it's valid for a URL. After encryption, I convert the bytes to Base64.
However, the result includes characters that are invalid for a URL,
notably '+' symbols. So, I have to cycle the output string through
HttpUtility.UrlEncode(). That takes time. I wrote my own URL-safe Base64
converter in C#, that's about as lean as I can make it. It is much slower
(about 6 times) than the the one provided. However, it runs in about 70%
of the time required to use the standard Base64 converter followed by a
trip through UrlEncode().
I believe that + is the only non URL valid character in base64 output.
Why not a simple String Replace ?
I am using .Net 2.0, and I have not found a way to coerce the built in
Base64 converter to use a character set that could avoid the trip through
UrlEncode. Am I missing anything? If not, is there any way to add this
capability to a future release?
Base64 is a standard. It is not common to allow mocking with a standard.
Arne
.
- Follow-Ups:
- Re: Base64 question
- From: Jim Brandley
- Re: Base64 question
- References:
- Base64 question
- From: Jim Brandley
- Re: Base64 question
- From: Arne Vajhøj
- Base64 question
- Prev by Date: Re: Base64 question
- Next by Date: Re: Base64 question
- Previous by thread: Re: Base64 question
- Next by thread: Re: Base64 question
- Index(es):
Relevant Pages
|