title: I am trying to figure what went wrong with my hash. I am getting a error 'hash values do not match' as a soap response
body: <p>I am trying to figure what went wrong with my hash. I am getting a error 'hash values do not match' as a soap response.</p>
  
  <p>The server log actually complains abt this hash value? Digest Value </p>
  
  <pre><code>     &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
              &lt;SignedInfo&gt;
                &lt;CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                &lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /&gt;
                &lt;Reference URI="#_1"&gt;
                  &lt;Transforms&gt;
                    &lt;Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                  &lt;/Transforms&gt;
                  &lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
                  &lt;DigestValue&gt;l6kqP048t5INzJT3W8gxVSXplaE=&lt;/DigestValue&gt;
                &lt;/Reference&gt;
  
  So Now I am trying to compare this DigestValue  with my code computed hash. 
  Not sure how else I could try to fix this 
  </code></pre>
  
  <p>1) Navigate to this element. Can I do this GetBytes? </p>
  
  <pre><code> XmlNode xmlnodeSigDigestValue = dc.DocumentElement.SelectSingleNode("/s:Envelope/s:Header/o:Security/sig:Signature", nsmgr).ChildNodes[0].ChildNodes[2].ChildNodes[2]";
   string sSourceData = xmlnodeSigDigestValue.FirstChild.Value;//brings me to l6kqP048t5INzJT3W8gxVSXplaE
   byte[] tmpHash = ASCIIEncoding.ASCII.GetBytes(sSourceData);    
  </code></pre>
  
  <p>2) This is the actual content of my request. So it is encrypting this and signing </p>
  
  <pre><code> string ToCompare = @"ISA*00*00*ZZ*400034 *ZZ*100000 0507*1750*^*00501**IL*1*PELEYTAY*JAVIER~REF*SY*5~DMG*D8*1981*M~DTP*291*RD8*20130115-20130115~EQ*30~SE*14*0001~GE*1*456452~IEA*1*526208405~";
  byte[] tmpNewHash;
  tmpNewHash = new MD5CryptoServiceProvider().ComputeHash(tmpSource);
  bool bEqual = false;
  if (tmpNewHash.Length == tmpHash.Length)
  {
      int i=0;
      while ((i &lt; tmpNewHash.Length) &amp;&amp; (tmpNewHash[i] == tmpHash[i]))
      {
          i += 1;
      }
      if (i == tmpNewHash.Length) 
      {
          bEqual = true;
      }
  }
  </code></pre>
  
  <p>Can I compare these two?. Am I understanding it correctly?
  How else would I compare hash?</p>