Skip to content
This repository
Browse code

inflate_code_string now deals with new packing

  • Loading branch information...
commit 430711184cb9a5ab8ad354b905f0492cf80a68f5 1 parent eec42cb
Brian Whitman bwhitman authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 API/fp.py
4 API/fp.py
@@ -57,7 +57,7 @@ def match(self):
57 57 def inflate_code_string(s):
58 58 """ Takes an uncompressed code string consisting of 0-padded fixed-width
59 59 sorted hex and converts it to the standard code string."""
60   - n = int(len(s) / 13.0) # 8 bytes for hash, 5 bytes for time
  60 + n = int(len(s) / 10.0) # 5 hex bytes for hash, 5 hex bytes for time (40 bits)
61 61
62 62 def pairs(l, n=2):
63 63 """Non-overlapping [1,2,3,4] -> [(1,2), (3,4)]"""
@@ -73,7 +73,7 @@ def pairs(l, n=2):
73 73 # Parse out n groups of 5 timestamps in hex; then n groups of 8 hash codes in hex.
74 74 end_timestamps = n*5
75 75 times = [int(''.join(t), 16) for t in pairs(s[:end_timestamps], 5)]
76   - codes = [int(''.join(t), 16) for t in pairs(s[end_timestamps:], 8)]
  76 + codes = [int(''.join(t), 16) for t in pairs(s[end_timestamps:], 5)]
77 77
78 78 assert(len(times) == len(codes)) # these should match up!
79 79 return ' '.join('%d %d' % (c, t) for c,t in zip(codes, times))

0 comments on commit 4307111

Please sign in to comment.
Something went wrong with that request. Please try again.