473,395 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ASCIIEncoding.GetString returns different values

I'm converting an asp.net 1.1 app to 2.0 and am having difficulty
determining why ASCIIEncoding.GetString returns a different value in
..NET 2.0 than 1.1. The code is simple but I can't locate the problem.
If someone could point out my oversight, I'd greatly appreciate it.

Thanks in advance!

Dim md5Hasher As New MD5CryptoServiceProvider
Dim encoder As New ASCIIEncoding
Dim strHashedBytes As Byte() =
md5Hasher.ComputeHash(encoder.GetBytes(SOMESTRING) )

Return encoder.GetString(strHashedBytes)

Aug 29 '06 #1
1 1554
>I'm converting an asp.net 1.1 app to 2.0 and am having difficulty
determining why ASCIIEncoding.GetString returns a different value in
.NET 2.0 than 1.1.
I think there were some changes in how it handles byte values 127.
But those are outside the ASCII range and if you have that in your
data (which you most likely will have in a computed hash) you
shouldn't be using ASCIIEncoding at all.

For random binary data, you should consider using Base64 encoding
instead if you need to store a string representation of it.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Roland Hall | last post by:
I have two(2) issues. I'm experiencing a little difficulty and having to resort to a work around. I already found one bug, although stated the bug was only in ODBC, which I'm not using. It...
2
by: Paul K | last post by:
I've run into a problem using this method that I have been able to work around, but I think that there is a more elegant way. I create an array of 256 bytes and use the SHBrowseForFolders API...
4
by: Dino Buljubasic | last post by:
Hi, I am using a function to hash a string value: public string generateMD5Hash(string input) { MD5 md5Provider; // MD5 provider instance // generate byte code for input byte inputData =...
2
by: wk | last post by:
Hi, I am reading a mp3 file's last 128 bytes and putting the text into string variables. What is happening is that the string is being stored with, probably some wrong encoding or character, and...
0
by: jdp | last post by:
I'm converting an asp.net 1.1 app to 2.0 and am having difficulty determining why ASCIIEncoding.GetString returns a different value in ..NET 2.0 than 1.1. The code is simple but I can't locate the...
9
by: serge | last post by:
/* Subject: How to build a procedure that returns different numbers of columns as a result based on a parameter. You can copy/paste this whole post in SQL Query Analyzer or Management Studio...
3
by: Frank Milverckowitz | last post by:
Hi, Newbie question about SqlDataReader column value access... In java jdbc code to get a value from a table column we can pass the column name (instead of an int index or offset): String...
17
by: nergal | last post by:
What is a good programming style in C to handle multiple returns in a function that returns different values? - To have a variable that is set to the return value, which is in the end of the...
1
by: mikfrost | last post by:
I'm trying to read the exif info in a JPG image file. Reading the ImageDescription field (270) that contains "abcæåø" only reads the first 3 characters "abc". The field was written with ACDSee...
3
by: =?Utf-8?B?RGFu?= | last post by:
When I use the following code I get "???" in place of the non-Ascii character. Is there any way to fix the conversion or do I have to write a function to search for "???" and replace with another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.