コード例 #1
0
ファイル: SHA3_384.py プロジェクト: R0ckNRolla/byob
    def digest(self):
        """Return the **binary** (non-printable) digest of the message that has been hashed so far.

        :return: The hash digest, computed over the data processed so far.
                 Binary form.
        :rtype: byte string
        """

        self._digest_done = True

        bfr = create_string_buffer(self.digest_size)
        result = _raw_keccak_lib.keccak_digest(self._state.get(), bfr,
                                               c_size_t(self.digest_size))
        if result:
            raise ValueError("Error %d while instantiating SHA-3/384" % result)

        self._digest_value = get_raw_buffer(bfr)
        return self._digest_value
コード例 #2
0
ファイル: SHA3_384.py プロジェクト: cloudera/hue
    def digest(self):
        """Return the **binary** (non-printable) digest of the message that has been hashed so far.

        :return: The hash digest, computed over the data processed so far.
                 Binary form.
        :rtype: byte string
        """

        self._digest_done = True

        bfr = create_string_buffer(self.digest_size)
        result = _raw_keccak_lib.keccak_digest(self._state.get(),
                                               bfr,
                                               c_size_t(self.digest_size))
        if result:
            raise ValueError("Error %d while instantiating SHA-3/384"
                             % result)

        self._digest_value = get_raw_buffer(bfr)
        return self._digest_value
コード例 #3
0
    def digest(self):
        """Return the **binary** (non-printable) digest of the message that has been hashed so far.

        You cannot update the hash anymore after the first call to ``digest``
        (or ``hexdigest``).

        :Return: A byte string of `digest_size` bytes. It may contain non-ASCII
         characters, including null bytes.
        """

        self._digest_done = True

        bfr = create_string_buffer(self.digest_size)
        result = _raw_keccak_lib.keccak_digest(self._state.get(), bfr,
                                               c_size_t(self.digest_size))
        if result:
            raise ValueError("Error %d while instantiating SHA-3/512" % result)

        self._digest_value = get_raw_buffer(bfr)
        return self._digest_value
コード例 #4
0
ファイル: SHA3_224.py プロジェクト: battyc/pycryptodome
    def digest(self):
        """Return the **binary** (non-printable) digest of the message that has been hashed so far.

        You cannot update the hash anymore after the first call to ``digest``
        (or ``hexdigest``).

        :Return: A byte string of `digest_size` bytes. It may contain non-ASCII
         characters, including null bytes.
        """

        self._digest_done = True

        bfr = create_string_buffer(self.digest_size)
        result = _raw_keccak_lib.keccak_digest(self._state.get(),
                                               bfr,
                                               c_size_t(self.digest_size))
        if result:
            raise ValueError("Error %d while instantiating SHA-3/224"
                             % result)

        self._digest_value = get_raw_buffer(bfr)
        return self._digest_value