Re: Converting byte[] to string - removing NULLs??
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Wed, 31 Jan 2007 20:46:29 -0000
j.a. harriman <jeffrey_no_spam_alias@xxxxxxxxxxxxx> wrote:
Your solution is certainly more thorough. The vlaue coming in is from a
known source and "should" always be the same.
Why? Encryption *often* ends up with a different length of encrypted
data to decrypted data.
I was able to trim the nulls at this point:
//Convert the byte array back into a string.
sDecryptedString =
textConverter.GetString(fromEncrypt).Trim('\0');
I still *strongly* urge you to try to fix it "properly".
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- References:
- Re: Converting byte[] to string - removing NULLs??
- From: Jon Skeet [C# MVP]
- Re: Converting byte[] to string - removing NULLs??
- From: j.a. harriman
- Re: Converting byte[] to string - removing NULLs??
- Prev by Date: Re: Reasoning behind the EventHandler(object, EventArgs) signature
- Next by Date: Re: Tracking login...
- Previous by thread: Re: Converting byte[] to string - removing NULLs??
- Next by thread: where can I get some cool code type questions for c#, asp.net and SQL
- Index(es):
Relevant Pages
|
|