Changeset - 0c2e10ad04a0
[Not reviewed]
0 1 0
Branko Majic (branko) - 10 years ago 2013-12-28 18:44:10
branko@majic.rs
PYD-4: Assign hex digest, and not decoded value, to digest variable.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pydenticon/__init__.py
Show inline comments
 
@@ -165,13 +165,14 @@ class Generator(object):
 
        """
 

	
 
        # If data seems to provide identical amount of entropy as digest, it
 
        # could be a hex digest already.
 
        if len(data) / 2 == self.digest_entropy / 8:
 
            try:
 
                digest = data.decode("hex")
 
                data.decode("hex")
 
                digest = data
 
            except TypeError:
 
                digest = self.digest(data).hexdigest()
 
        else:
 
            digest = self.digest(data).hexdigest()
 

	
 
        return [int(digest[i * 2:i * 2 + 2], 16) for i in range(16)]
0 comments (0 inline, 0 general)