use stdlib OrderedDict (#25319)
This commit is contained in:
parent
38298c3192
commit
103acb8dea
|
@ -1,10 +1,10 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import math
|
import math
|
||||||
import base64
|
import base64
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from django.contrib.auth import hashers
|
from django.contrib.auth import hashers
|
||||||
from django.utils.crypto import constant_time_compare
|
from django.utils.crypto import constant_time_compare
|
||||||
from django.utils.datastructures import SortedDict
|
|
||||||
from django.utils.translation import ugettext_noop as _
|
from django.utils.translation import ugettext_noop as _
|
||||||
from django.utils.encoding import force_bytes
|
from django.utils.encoding import force_bytes
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
|
@ -78,7 +78,7 @@ class Drupal7PasswordHasher(hashers.BasePasswordHasher):
|
||||||
def safe_summary(self, encoded):
|
def safe_summary(self, encoded):
|
||||||
algorithm, iterations, salt, hash = encoded.split('$', 3)
|
algorithm, iterations, salt, hash = encoded.split('$', 3)
|
||||||
assert algorithm == self.algorithm
|
assert algorithm == self.algorithm
|
||||||
return SortedDict([
|
return OrderedDict([
|
||||||
(_('algorithm'), algorithm),
|
(_('algorithm'), algorithm),
|
||||||
(_('iterations'), iterations),
|
(_('iterations'), iterations),
|
||||||
(_('salt'), hashers.mask_hash(salt)),
|
(_('salt'), hashers.mask_hash(salt)),
|
||||||
|
@ -108,7 +108,7 @@ class CommonPasswordHasher(hashers.BasePasswordHasher):
|
||||||
def safe_summary(self, encoded):
|
def safe_summary(self, encoded):
|
||||||
algorithm, salt, hash = encoded.split('$', 2)
|
algorithm, salt, hash = encoded.split('$', 2)
|
||||||
assert algorithm == self.algorithm
|
assert algorithm == self.algorithm
|
||||||
return SortedDict([
|
return OrderedDict([
|
||||||
(_('algorithm'), algorithm),
|
(_('algorithm'), algorithm),
|
||||||
(_('salt'), hashers.mask_hash(salt, show=2)),
|
(_('salt'), hashers.mask_hash(salt, show=2)),
|
||||||
(_('hash'), hashers.mask_hash(hash)),
|
(_('hash'), hashers.mask_hash(hash)),
|
||||||
|
|
Loading…
Reference in New Issue