fix hash generation to match what's done in the database (#9606)

This commit is contained in:
Frédéric Péters 2016-01-12 19:00:02 +01:00
parent dd6d7d3ebc
commit 298c15b67f
1 changed files with 2 additions and 4 deletions

View File

@ -8,7 +8,6 @@ import os
import requests
import logging
from hashlib import sha256
import hmac
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
@ -57,9 +56,8 @@ class Command(BaseCommand):
def get_invoice_hash(self, *args):
hash = hmac.HMAC(self.secret, digestmod=sha256, msg=''.join(map(lambda s: str(s), args)))
return hash.hexdigest()[:8]
msg = ''.join(map(lambda s: str(s), args)
return sha256(msg).hexdigest()[:7]
def handle(self, *args, **options):
if options['list']: