# Brief: Computes GNUNET style Content Hash Key for a given file
# Author: Sree Harsha Totakura
-from builtins import str
-from builtins import range
-from past.utils import old_div
-from builtins import object
from hashlib import sha512
import logging
import os
bds = compute_tree_size_(depth)
if (depth > 0):
end_offset -= 1
- ret = old_div(end_offset, bds)
+ ret = end_offset // bds
return ret % CHK_PER_INODE
ret = CHK_PER_INODE
else:
bds /= CHK_PER_INODE
- ret = old_div(mod, bds)
+ ret = mod // bds
if (mod % bds) is not 0:
ret += 1
return ret
#
# SPDX-License-Identifier: AGPL3.0-or-later
-from builtins import str
-from builtins import range
-from past.utils import old_div
import argparse
import random
from math import ceil, log, floor
-from past.builtins import xrange
def bsc(n):
def simulate(k, n, verbose):
assert k < n
- largest_arc = old_div(int(2**ceil(log(n, 2))), 2)
+ largest_arc = int(2**ceil(log(n, 2))) // 2
num_ghosts = (2 * largest_arc) - n
if verbose:
print("we have", num_ghosts, "ghost peers")
sum = 0.0
for n in range(0, args.r):
sum += simulate(args.k, args.n, args.verbose)
- print(old_div(sum, args.r))
+ print(sum // args.r)