Skip to content

Commit 687c537

Browse files
committed
Fix compat issues
1 parent 66195a3 commit 687c537

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

hyperloglog/hll.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def add(self, value):
116116
# w = <x_{p}x_{p+1}..>
117117
# M[j] = max(M[j], rho(w))
118118

119-
x = int.from_bytes(sha1(packb(value)).digest()[:8])
119+
x = int.from_bytes(sha1(packb(value)).digest()[:8], byteorder='big')
120120
j = x & (self.m - 1)
121121
w = x >> self.p
122122

@@ -134,7 +134,7 @@ def add_bulk(self, values):
134134

135135
assert not isinstance(values, (bytes, str)) and hasattr(values, '__iter__')
136136

137-
x = np.fromiter((int.from_bytes(sha1(packb(value)).digest()[:8]) for value in values), np.uint64)
137+
x = np.fromiter((int.from_bytes(sha1(packb(value)).digest()[:8], byteorder='big') for value in values), np.uint64)
138138
j = x & (self.m - 1)
139139
w = x >> self.p
140140
rho = get_rho_vec(w, 64 - self.p)

hyperloglog/shll.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def add(self, timestamp, value):
7171
# w = <x_{p}x_{p+1}..>
7272
# <t_i, rho(w)>
7373

74-
x = int.from_bytes(sha1(packb(value)).digest()[:8])
74+
x = int.from_bytes(sha1(packb(value)).digest()[:8], byteorder='big')
7575
j = x & (self.m - 1)
7676
w = x >> self.p
7777
R = get_rho(w, 64 - self.p)

0 commit comments

Comments
 (0)