sha256

NodeJS “crypto” hash seems to produce different output than Crypto-JS javascript library

雨燕双飞 提交于 2019-12-12 14:26:13
问题 I am using NodeJS's bundled crypto module for SHA256 hashing on the server-side. On the client-side, I am using a javascript library called Crypto-JS. I am using SHA256 hashes for a login system that uses classical nonce-based authentication. However, my server-side and client-side hash-digests don't match up even when the hash-messages are the same (I have checked this). Even the length of the hash-digests are different. This is a snippet of my client-side implementation: var password_hash =

SHA256 hash calculation

爱⌒轻易说出口 提交于 2019-12-12 13:20:57
问题 for my employer I have to present customers of a web-app with checksums for certain files they download. I'd like to present the user with the hash their client tools are also likely to generate, hence I have been comparing online hashing tools. My question is regarding their form of hashing, since they differ, strangely enough. After a quick search I tested with 5: http://www.convertstring.com/Hash/SHA256 http://www.freeformatter.com/sha256-generator.html#ad-output http://online-encoder.com

HMAC-SHA256 issue in Shopify oauth (Output does not match)

你离开我真会死。 提交于 2019-12-12 09:16:47
问题 I'm trying to publish an app on Shopify marketplace by following this documentation. And I'm stuck on step-3 of the oauth documentation wherein you have to do 'HMAC Signature Validation'. Documentation states that you have to process the string (specified below) through HMAC-SHA256 using app's shared secret key. String = "shop=some-shop.myshopify.com&timestamp=1337178173" I'm trying to implement the steps using Java. Following is gist of the code that I have used. private static final String

Api key authentication for coinbase

北慕城南 提交于 2019-12-12 06:39:29
问题 I'm trying to write a request for API coinbase.com, but I can not correctly generate a signature. I've been trying to find my mistake for 2 days, but I can not. I analyzed the code for other languages on the page: https://developers.coinbase.com/docs/wallet/api-key-autumnicathion but I do not see any differences in implementation. Help me please. <?php $g_coinbase_key = 'KcxisxqmWRVgtwsj'; $g_coinbase_secret = 'isOLGBLaEkCy3ROQMvmjonGmXK0KRmUS'; $time = time(); $method = "GET"; $path = '/v2

HmacSHA256 algorithm in Android API 23

≯℡__Kan透↙ 提交于 2019-12-12 06:38:57
问题 I am trying to generate hash value in my Android app (API 23). I followed this link- https://developer.android.com/reference/javax/crypto/Mac.html and below code should work as per it. Mac hmacSha256 = Mac.getInstance("HmacSHA1"); But this gives compile time error- java.security.NoSuchAlgorithmException I searched and tried few solutions from across other Stackoverflow posts but they didn't work. Tried this- MessageDigest digest = MessageDigest.getInstance("SHA-256"); got same error. My

Validating JWT signed with hmac-sh256

我的未来我决定 提交于 2019-12-12 04:53:47
问题 I am working on a project to use the Katana OpenID Connect middleware to authenticate with a third party (OpenAM) provider. The provider is signing the JWT with hmac-sh256. When the OpenID middleware is validating the JWT via a call to ValidateToken it is throwing the following exception: {"IDX10503: Signature validation failed. Keys tried: 'System.IdentityModel.Tokens.X509AsymmetricSecurityKey\r\n'.\nExceptions caught:\n 'System.InvalidOperationException: IDX10618: AsymmetricSecurityKey

Signing a message with hmac and sha256 in dart

僤鯓⒐⒋嵵緔 提交于 2019-12-11 18:27:42
问题 I try to generate a sha256 HMAC using a base64-decoded secret key on a message. I would like to use the dart language. In python, I could do it with the following code: # PYTHON CODE import hmac, hashlib, base64 ... message = 'blabla' secret = 'DfeRt[...]==' secret_b64 = base64.b64decode(secret) signature = hmac.new(secret_b64, message, hashlib.sha256) signature_b64 = signature.digest().encode('base64').rstrip('\n') Here is what I tried with dart: // DART CODE import 'package:crypto/crypto

Hash value from C function

a 夏天 提交于 2019-12-11 18:26:47
问题 I have a problem and hope you can help me. I have a function written in C that returns hash a value. My headache is when I execute the program from another tool it takes a lot of time to run, probably because inside my function I run a command that hashes my value in SHA256, so I would like to know if there is another way to do it, maybe a function or something like that. Here is what I have: const char *EncryptSHA256 (char *Arg1) { char command[128]; char result[512]; //I want to replace

calculate hash of binary file containing certain bytes

醉酒当歌 提交于 2019-12-11 17:43:47
问题 I'm having trouble understanding the principle/method, on how to "manually" calculate a file's hash (sha256) which consist of certain bytes. To put into an example: I have this binary file consisting of these bytes. 2C F2 BA A3 0E 26 5A 3B 2A 1F 01 4A 01 66 60 02 How to get following (correct) hash of the file? ea3cbd30dc6c18914d2cdafdd8bec0ff4ce5995c7b484cce3237900336abb574 回答1: 1. Convert all bytes to ASCII. 2. Hash ASCII string to get correct hash from the file. Doing this manually is not

What data is used to calculate the sha256 messagedigest of this asn.1 message?

心已入冬 提交于 2019-12-11 15:38:43
问题 Given the following asn.1 message, how is the sha256 message digest, "8798168E6F7F3118EDE8522B6336DFB56CFDF95DB7063CB7230EF00B4D666D1A", calculated? I realize it is a 32 byte hash of some data. What specific data is used to calculate the hash? This is a tr34 document. Using openssl, I should be able to come up with the same hash as long as I'm using the same chunck of data from the message. -----BEGIN TR34_Sample_UBT_KDH PEM File-----