pycurl.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:iota.lib.py 作者: iotaledger 项目源码 文件源码
def squeeze(self, trits):
    # type: (MutableSequence[int]) -> None
    """
    Squeeze trits from the sponge.

    :param trits:
      Sequence that the squeezed trits will be copied to.
      Note: this object will be modified!
    """
    #
    # Squeeze is kind of like the opposite of absorb; it copies trits
    # from internal state to the ``trits`` parameter, one hash at a
    # time, and transforming internal state in between hashes.
    #
    # However, only the first hash of the state is "public", so we
    # can simplify the implementation somewhat.
    #

    # Ensure that ``trits`` can hold at least one hash worth of trits.
    trits.extend([0] * max(0, HASH_LENGTH - len(trits)))

    # Copy exactly one hash.
    trits[0:HASH_LENGTH] = self._state[0:HASH_LENGTH]

    # One hash worth of trits copied; now transform.
    self._transform()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号