コード例 #1
0
 def wots_sk_gen(self, secret_seed, adrs: ADRS):  # Not necessary
     sk = []
     for i in range(0, self._len_0):
         adrs.set_chain_address(i)
         adrs.set_hash_address(0)
         sk.append(prf(secret_seed, adrs.copy(), self._n))
     return sk
コード例 #2
0
    def chain(self, x, i, s, public_seed, adrs: ADRS):
        if s == 0:
            return bytes(x)

        if (i + s) > (self._w - 1):
            return -1

        tmp = self.chain(x, i, s - 1, public_seed, adrs)

        adrs.set_hash_address(i + s - 1)
        tmp = hash(public_seed, adrs, tmp, self._n)

        return tmp
コード例 #3
0
    def wots_pk_gen(self, secret_seed, public_seed, adrs: ADRS):
        wots_pk_adrs = adrs.copy()
        tmp = bytes()
        for i in range(0, self._len_0):
            adrs.set_chain_address(i)
            adrs.set_hash_address(0)
            sk = prf(secret_seed, adrs.copy(), self._n)
            tmp += bytes(self.chain(sk, 0, self._w - 1, public_seed, adrs.copy()))

        wots_pk_adrs.set_type(ADRS.WOTS_PK)
        wots_pk_adrs.set_key_pair_address(adrs.get_key_pair_address())

        pk = hash(public_seed, wots_pk_adrs, tmp, self._n)
        return pk