CopyPastor

Detecting plagiarism made easy.

Score: 2; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2021-06-06
by Maxqueue

Original Post

Original - Posted on 2021-06-06
by Maxqueue



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I ran into same issue and my code was same as yours basically. I changed to the following (c#) and it finally worked. Weird thing is coinbase pro is only exchange i have had issues with so far with the signature. In any case here is the code that worked for me. Hope this helps. Would have saved me hours
public string ComputeSignature( HttpMethod httpMethod, string secret, double timestamp, string requestUri, string contentBody = "") { var convertedString = System.Convert.FromBase64String(secret); var prehash = timestamp.ToString("F0", CultureInfo.InvariantCulture) + httpMethod.ToString().ToUpper() + requestUri + contentBody; return HashString(prehash, convertedString); }
private string HashString(string str, byte[] secret) { var bytes = Encoding.UTF8.GetBytes(str); using (var hmaccsha = new HMACSHA256(secret)) { return System.Convert.ToBase64String(hmaccsha.ComputeHash(bytes)); } }
I ran into same issue and my code was same as yours basically. I changed to the following (c#) and it finally worked. Weird thing is coinbase pro is only exchange i have had issues with so far with the signature. In any case here is the code that worked for me. Hope this helps. Would have saved me hours
public string ComputeSignature( HttpMethod httpMethod, string secret, double timestamp, string requestUri, string contentBody = "") { var convertedString = System.Convert.FromBase64String(secret); var prehash = timestamp.ToString("F0", CultureInfo.InvariantCulture) + httpMethod.ToString().ToUpper() + requestUri + contentBody; return HashString(prehash, convertedString); }
private string HashString(string str, byte[] secret) { var bytes = Encoding.UTF8.GetBytes(str); using (var hmaccsha = new HMACSHA256(secret)) { return System.Convert.ToBase64String(hmaccsha.ComputeHash(bytes)); } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;