From 97e503b954ee372a99c4f789562b91495ce49375 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 14 Oct 2025 09:28:37 +0200 Subject: [PATCH] compare via hex --- shared/src/helper/BinaryData.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/shared/src/helper/BinaryData.ts b/shared/src/helper/BinaryData.ts index 70e4954fd..aeff97029 100644 --- a/shared/src/helper/BinaryData.ts +++ b/shared/src/helper/BinaryData.ts @@ -27,12 +27,6 @@ export class BinaryData { } asBuffer(): Buffer { - if (this.buf === undefined || !Buffer.isBuffer(this.buf)) { - if (this.buf) { - logging.error('invalid buf: ', this.buf) - } - throw new Error('buf is invalid') - } return this.buf } @@ -45,10 +39,10 @@ export class BinaryData { logging.error('other is invalid', other) return false } - if (logging.isDebugEnabled()) { - logging.debug('compare hex: ', this.hex, other.asHex(), this.hex === other.asHex()) - } - return this.buf.compare(other.asBuffer()) === 0 + return this.asHex() === other.asHex() + // don't work reliable, in specific cases fail with: + // The "otherBuffer" argument must be an instance of Buffer or Uint8Array. Received an instance of Object + // return this.buf.compare(other.asBuffer()) === 0 } }