From 139520e51c3b7f8c3fd5c4c553dd13e12ffd744d Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 15 Oct 2021 14:16:06 -0400 Subject: Database python api --- python/databuffer.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python/databuffer.py') diff --git a/python/databuffer.py b/python/databuffer.py index baf35b17..cc40c5ad 100644 --- a/python/databuffer.py +++ b/python/databuffer.py @@ -129,6 +129,12 @@ class DataBuffer: ctypes.memmove(buf, data, len(self)) return buf.raw + def __eq__(self, other: 'DataBuffer') -> bool: + # Not cryptographically secure + if len(self) != len(other): + return False + return bytes(self) == bytes(other) + def escape(self) -> str: return core.BNDataBufferToEscapedString(self.handle) -- cgit v1.3.1