Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Necesita el equivalente de JS

Código Python:

 signature = hmac.new(bytearray.fromhex(key), data.encode('utf-8'), hashlib.sha256).hexdigest()

Soluciones que he probado

 var compute_hmac = crypto.createHmac('sha256', key).update(data).digest('hex'); var compute_hmac = crypto.createHmac('sha256', Buffer.from(key, 'hex').toString()).update(data).digest('hex');

const hmac = crypto.createHmac('sha256', Buffer.from(key, 'hex'))

Intentando validar las firmas de webhook de la siguiente API

https://developer.close.com/topics/webhooks/

data es la carga útil recibida, lo mismo se pasa a python y al código JS. Pero de alguna manera, el resumen hexadecimal del código python se valida y el código hexadecimal del código JS es completamente diferente.

Consulte el enlace API mencionado anteriormente (firmas de webhook) para comprender lo que estoy tratando de lograr

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Pase directamente el búfer de teclas en lugar de agregarle .toString()

 var compute_hmac = crypto.createHmac('sha256', Buffer.from(key, 'hex')).update(data).digest('hex');

codigo py

 import hashlib import hmac key ="A1FF92"; data = "hello" signature = hmac.new(bytearray.fromhex(key), data.encode('utf-8'), hashlib.sha256).hexdigest() //78a1151ddd4f298a134e4625362af2ab8ef4bd49719e17053ec1eadd4cbf1bab

código de nodo

 var crypto = require("crypto") var key = "A1FF92" var data="hello"; var compute_hmac = crypto.createHmac('sha256', Buffer.from(key, 'hex')).update(data).digest('hex'); // 78a1151ddd4f298a134e4625362af2ab8ef4bd49719e17053ec1eadd4cbf1bab
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!