<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Received Hash and generated hash not matching in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67592#M40970</link>
    <description>Also, if you’re using legacy methods you’re using the wrong string.</description>
    <pubDate>Thu, 02 May 2019 19:55:21 GMT</pubDate>
    <dc:creator>Renaissance</dc:creator>
    <dc:date>2019-05-02T19:55:21Z</dc:date>
    <item>
      <title>Received Hash and generated hash not matching</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67391#M40809</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using Authorized.net with c#. I have getting some problem at the time of transaction. Transaction received hash and generated received hash not matching. Can any one help me regarding this&amp;nbsp; where I am wrong? Thanks in advance.&lt;BR /&gt;My code is given below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Received hash:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string key =Convert.ToString("abc123456");&lt;/P&gt;&lt;P&gt;string value = Convert.ToString(loginID + "^" + seq + "^" + timeStamp + "^" + amount + "^");&lt;/P&gt;&lt;P&gt;string fingerprint = HMACSHA512(key, value);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public string HMACSHA512(string key, string textToHash)&lt;BR /&gt;{&lt;BR /&gt;if (string.IsNullOrEmpty(key))&lt;BR /&gt;throw new ArgumentNullException("HMACSHA512: key", "Parameter cannot be empty.");&lt;BR /&gt;if (string.IsNullOrEmpty(textToHash))&lt;BR /&gt;throw new ArgumentNullException("HMACSHA512: textToHash", "Parameter cannot be empty.");&lt;BR /&gt;if (key.Length % 2 != 0 || key.Trim().Length &amp;lt; 2)&lt;BR /&gt;{&lt;BR /&gt;throw new ArgumentNullException("HMACSHA512: key", "Parameter cannot be odd or less than 2 characters.");&lt;BR /&gt;}&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;byte[] k = Enumerable.Range(0, key.Length)&lt;BR /&gt;.Where(x =&amp;gt; x % 2 == 0)&lt;BR /&gt;.Select(x =&amp;gt; Convert.ToByte(key.Substring(x, 2), 16))&lt;BR /&gt;.ToArray();&lt;BR /&gt;HMACSHA512 hmac = new HMACSHA512(k);&lt;BR /&gt;byte[] HashedValue = hmac.ComputeHash((new System.Text.ASCIIEncoding()).GetBytes(textToHash));&lt;BR /&gt;return BitConverter.ToString(HashedValue).Replace("-", string.Empty);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;throw new Exception("HMACSHA512: " + ex.Message);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Received hash is given below: "9037CD31FADCCAD8EDFBAF97E27D58EA354FF3FB29060E09BC7C2BF7BD29F2F7D1E5F3CA96EEC2BB27B8BBA7677970851A0E65867E04BE812EC437A631E6122F"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the generated hash value process is given below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string key = Convert.ToString("abc123456");&lt;/P&gt;&lt;P&gt;string str_generated_hash = HMACSHA512(key, "^" + x_login + "^" + x_trans_id + "^" + x_amount + "^");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using same function HMACSHA512 as given above. The generated hash value is "BF904ED074B81754725D1E7E547EBFC5B89EE6A6DEE1A08B79C536E1652D617D8644C7948B269A8C542D5D6783EF748A9000D51DE4BD94CFDF30CA85C4EE8B4B" which is different from received hash value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 11:26:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67391#M40809</guid>
      <dc:creator>akhalder123</dc:creator>
      <dc:date>2019-04-15T11:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Received Hash and generated hash not matching</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67589#M40967</link>
      <description>&lt;P&gt;I'm having the same issue. Using the given function to generate the hash, the received hash and the generated hash are not the same. The issue I'm having is that I don't know the format of the amount that is supposed to be in the message string that is being hashed. The&amp;nbsp;&lt;STRONG&gt;Transaction Hash Upgrade Guide&lt;/STRONG&gt; gives this example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example, if your API Login ID is "ANet123", the value of&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;transId&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;is "20987654321", and the value of&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;amount&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;is "9.99", the message string would look like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;^ANet123^20987654321^9.99^&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems like the format of the amount should be XXXX.XX, but it could also be X,XXX.XX. I have tried both formats and neither work for me. The documentation also says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The transaction amount that we send in&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;createTransactionResponse&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;in the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;amount&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;element.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The other problem here is that I'm not getting an amount back in the &lt;STRONG&gt;createTransactionResponse, &lt;/STRONG&gt;so that doesn't help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've submitted a support ticket with Authorize.net, but never heard back (submitted it Friday 4/26 and haven't heard back on Thurs. 5/2).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;John&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 17:15:15 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67589#M40967</guid>
      <dc:creator>Rcm1Developer</dc:creator>
      <dc:date>2019-05-02T17:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Received Hash and generated hash not matching</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67591#M40969</link>
      <description>&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/8561"&gt;@Rcm1Developer&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;The number should not have a ,. It should be formatted as a float to 2 places. You use the amount you submitted in the transaction request.</description>
      <pubDate>Thu, 02 May 2019 19:54:15 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67591#M40969</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-05-02T19:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Received Hash and generated hash not matching</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67592#M40970</link>
      <description>Also, if you’re using legacy methods you’re using the wrong string.</description>
      <pubDate>Thu, 02 May 2019 19:55:21 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67592#M40970</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-05-02T19:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Received Hash and generated hash not matching</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67601#M40979</link>
      <description>&lt;P&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/26959"&gt;@Renaissance&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&amp;nbsp; Glad to know the actual format, though I tried the format you mention (actually tried 12 different formats) but it still didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not actually sure what you mean by legacy methods. I'm posting XML to the Sandbox with&amp;nbsp;&lt;A href="https://apitest.authorize.net/xml/v1/request.api" target="_blank"&gt;https://apitest.authorize.net/xml/v1/request.api&lt;/A&gt; and using&amp;nbsp;&lt;EM&gt;&lt;A href="https://developer.authorize.net/api/reference/#payment-transactions-charge-a-credit-card" target="_self"&gt;createTransactionRequest&lt;/A&gt; &lt;/EM&gt;in the format from the API documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 16:32:08 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67601#M40979</guid>
      <dc:creator>Rcm1Developer</dc:creator>
      <dc:date>2019-05-03T16:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Received Hash and generated hash not matching</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67602#M40980</link>
      <description>&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/8561"&gt;@Rcm1Developer&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;Legacy methods are SIM/DPM/AIM. SIM/DPM have a different string and about 9 out of 10 trying to work out sha512 on this forum are using those methods. Reason is they cannot submit transactions or process responses without a hash. For API folks like you and I it is more optional. Their apps will break when MD5 is axed if they don’t figure this out.&lt;BR /&gt;&lt;BR /&gt;You are using the right fields for the string if you’re using the modern API. If you want me to help you, post a sample transaction with the following:&lt;BR /&gt;&lt;BR /&gt;API call you are using: I.e. chargeCreditCard, capturePreviouslyAuthorizedAmount, etc.&lt;BR /&gt;Amount, login, and transid.&lt;BR /&gt;The string you are constructing (i.e. the string you put in your hash function)&lt;BR /&gt;SignatureKey&lt;BR /&gt;Authnet delivered hash&lt;BR /&gt;The hash your app outputs&lt;BR /&gt;&lt;BR /&gt;Obviously you want to use sandbox credentials if you’re posting them here. You can also IM me. Next time I’m killing time I will run your string and see what I get. Can probably zero in on your problem in just a few mins.</description>
      <pubDate>Fri, 03 May 2019 17:06:29 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Received-Hash-and-generated-hash-not-matching/m-p/67602#M40980</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-05-03T17:06:29Z</dc:date>
    </item>
  </channel>
</rss>

