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
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