def fors_pk_from_sig(self, sig_fors, m, public_seed, adrs: ADRS): m_int = int.from_bytes(m, 'big') sigs = self.auths_from_sig_fors(sig_fors) root = bytes() for i in range(0, self._k): idx = (m_int >> (self._k - 1 - i) * self._a) % self._t sk = sigs[i][0] adrs.set_tree_height(0) adrs.set_tree_index(i * self._t + idx) node_0 = hash(public_seed, adrs.copy(), sk, self._n) node_1 = 0 auth = sigs[i][1] adrs.set_tree_index(i * self._t + idx) # Really Useful? for j in range(0, self._a): adrs.set_tree_height(j + 1) if math.floor(idx / 2**j) % 2 == 0: adrs.set_tree_index(adrs.get_tree_index() // 2) node_1 = hash(public_seed, adrs.copy(), node_0 + auth[j], self._n) else: adrs.set_tree_index((adrs.get_tree_index() - 1) // 2) node_1 = hash(public_seed, adrs.copy(), auth[j] + node_0, self._n) node_0 = node_1 root += node_0 fors_pk_adrs = adrs.copy() fors_pk_adrs.set_type(ADRS.FORS_ROOTS) fors_pk_adrs.set_key_pair_address(adrs.get_key_pair_address()) pk = hash(public_seed, fors_pk_adrs, root, self._n) return pk