damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | LICENSE

commit e8a9d693650195b3d7e01199d58ab56ce756c873
parent 97fbee85c061b410b7d0d6ad58a53aa6dae53d97
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 15 Apr 2022 11:25:59 -0700

fix hex decode

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Nostr/ProofOfWork.swift | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git 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 }