J
Jim Brandley
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 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?
Thanks,
Jim Brandley
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 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?
Thanks,
Jim Brandley