Skip to content

Instantly share code, notes, and snippets.

@petres
petres / bin_numbers.py
Last active December 18, 2023 12:58 — forked from lukpueh/bin_numbers.py
TUF hash bin delegation (optimal bin numbers)
"""TUF hash bin delegation (optimal bin numbers)
Calculate the optimal number of bins for given number of target files.
Problem description
===================
Given 'targets_count', 'bin_meta_size' and 'target_meta_size', I want to know
the optimal 'bin_count', for which 'snapshot_size' plus 'bin_size' are minimal.
Constraints