예제 #1
0
파일: hashes.py 프로젝트: xriss/gamecake
    def copy(self):
        """
        Returns a separate copy of this hashing object. An update
        to this copy won't affect the original object.
        """
        copy = self.new("")

        _ffi.memmove(copy._native_object, self._native_object,
                     self._native_size)

        return copy
예제 #2
0
    def copy(self):
        """
        Returns a separate copy of this hashing object. An update
        to this copy won't affect the original object.
        """
        copy = self.new("")

        _ffi.memmove(copy._native_object,
                     self._native_object,
                     self._native_size)

        return copy
예제 #3
0
    def digest(self):
        """
        Returns the hash value of this hashing object as a string
        containing 8-bit data. The object is not altered in any
        way by this function; you can continue updating the object
        after calling this function.
        """
        result = t2b("\0" * self.digest_size)

        if self._native_object:
            obj = _ffi.new(self._native_type)

            _ffi.memmove(obj, self._native_object, self._native_size)

            ret = self._final(obj, result)
            if ret < 0:
                raise WolfCryptError("Hash finalize error (%d)" % ret)

        return result
예제 #4
0
파일: hashes.py 프로젝트: xriss/gamecake
    def digest(self):
        """
        Returns the hash value of this hashing object as a string
        containing 8-bit data. The object is not altered in any
        way by this function; you can continue updating the object
        after calling this function.
        """
        result = t2b("\0" * self.digest_size)

        if self._native_object:
            obj = _ffi.new(self._native_type)

            _ffi.memmove(obj, self._native_object, self._native_size)

            ret = self._final(obj, result)
            if ret < 0:
                raise WolfCryptError("Hash finalize error (%d)" % ret)

        return result