From e8a9d693650195b3d7e01199d58ab56ce756c873 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 15 Apr 2022 11:25:59 -0700 Subject: [PATCH] fix hex decode Signed-off-by: William Casarin --- damus/Nostr/ProofOfWork.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/damus/Nostr/ProofOfWork.swift b/damus/Nostr/ProofOfWork.swift index 21d199fd..c85f031e 100644 --- a/damus/Nostr/ProofOfWork.swift +++ b/damus/Nostr/ProofOfWork.swift @@ -77,7 +77,14 @@ func hex_decode(_ str: String) -> [UInt8]? { var ret: [UInt8] = [] let chars = Array(str.utf8) + var i: Int = 0 for c in zip(chars, chars[1...]) { + i += 1 + + if i % 2 == 0 { + continue + } + guard let c1 = char_to_hex(c.0) else { return nil }