For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
var stringToHash = "10123456789" + "2014:11:25-15:42:00" + "20.00" + "826" + "sharedsecret";
var bytes = Encoding.ASCII.GetBytes(stringToHash);
var hexString = BitConverter.ToString(bytes).Replace("-", string.Empty);
SHA1 sha = new SHA1CryptoServiceProvider();
var password = sha.ComputeHash(bytes);
var result = BitConverter.ToString(password).ToLower().Replace("-", string.Empty);
var hexStringBytes = Encoding.ASCII.GetBytes(hexString);
var hexStringPassword = sha.ComputeHash(hexStringBytes);
var hexStringResult = BitConverter.ToString(hexStringPassword).ToLower().Replace("-", string.Empty);
The first two outputs are the same. The original strings are identical, as are the ASCII hex arrays after conversion, but sha1() in PHP is giving me a different outcome to .net's SHA1CryptoServiceProvider. If I convert that output to a string and hash it again, the result is also different.
In .net, an object has to be in the form of a byte array before you can create an SHA hash from it, and I don't understand what I need to convert to the byte array to produce the same output as the PHP code.
This is problematic as the third party service I am posting to uses the PHP version to verify an object on their end, and my program is written in .net. I could write a middle-man in PHP and relay through that, but I really don't want have to do that.
Any insight into why the two are giving different results? Thanks
Message=Riferimento a un oggetto non impostato su un'istanza di oggetto.
in Prova1.ViewModel.MainViewModel.SalvaBusta(Busta Bus) in k:\c#\MVVMLight\Prova1\Prova1\ViewModel\MainViewModel.cs:riga 102
Just to clarify: please put your environment international settings to English to allow all the users to answer (at least to understand the error message).
It looks you have a pointer not associated with any object, check or add some initialization. The message tells you precisely which line of code is wrong, but we have no explicit line numeration visible.
Busta.BustaID = _serviceProxy.CreateBusta(Bus);
is totally wrong: you are using the name of the class as it if is an OBJECT. You would probably use Bus instead of Busta.
To help you not doing the same mistakes be careful to differentiate consistently between the name of a type (or class or enum) and it's object identifiers, or it is easy to be confused.