1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
Return-Path: <pieter.wuille@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 26E67135E
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 13 Jun 2018 02:44:50 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-ot0-f178.google.com (mail-ot0-f178.google.com
[74.125.82.178])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 92846326
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 13 Jun 2018 02:44:49 +0000 (UTC)
Received: by mail-ot0-f178.google.com with SMTP id w13-v6so1232344ote.11
for <bitcoin-dev@lists.linuxfoundation.org>;
Tue, 12 Jun 2018 19:44:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:cc; bh=XwvkSgxlRUIMb69qGNmL90q1BYYjzhSVNJrhvE2l68Y=;
b=JJDL7xopkiObZdkxObJQz+sFp9Xr+hcnabO7T1qa541JlQUELarpf3phoxMk/LIBVu
1ioP73342ibzwipx1iRAjcdLPesxTyWLROh8RUEgC48sd+P2cL8WKLblHtfV42jW6oGD
uQUpyNjStqwJkOsw6kOhBPNc4FqP/a4d5UBF72XBHcy+vhPAR1KPmd+u3i60MJhhwpb7
pUOOefLTp/PcSECprKwXPzYtaThXJEV8RsNRe7zVPaSKmBxeSwcVumhQsyCFFo1AEhSh
leyk2KWLUTCbMTW5WFpK/BRVF5ke9sQV5KoT1GzbTjHIkEgXkJkN7bIukjYGoJuGhK2z
7IGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to:cc;
bh=XwvkSgxlRUIMb69qGNmL90q1BYYjzhSVNJrhvE2l68Y=;
b=DrJOIg/pwKXv2HLEggZ4VjSU2KBwpWz2f1ZckJOWbm7CkeJRfiE0GMYplcStMktGvV
1+3ZnTOF5/skIqjQVMlpJblBMAsU8KKrjv9biZ6ObzwLbaemYWzqjXxjQ97mqrlOKctH
F1yfmNgX6AxmkdBjhZAZpZZN5QNUjY9lOIEmtKtJ/gQRd9+5x6DeMrnh/vE7X25GAbGe
jEScwqo3unF7ptXUp8m76JcSul6atE0yaIONEIyPjHT0GoHw6lGHAAYXEBJRqUjCssCw
U63VYejgt0s5E1AKybJ2ubCYJ9HwxTjhMwLtX0eewKgkwTUEDVZqz9G4Z+TagVu/nnCe
SXaw==
X-Gm-Message-State: APt69E1EFxfntB3T3Qh4ZLnNPIn9O3m2MQxovsvNKwqbkqDNOc/WoIO5
knETUA0Ipu3YmHC96SrdI09dhi3faODTrx7RrUOPYXFO
X-Google-Smtp-Source: ADUXVKKvKHTcp+XCHL4J2Vs21vvPbshFchSOPsY+4XIc8qOWsvBg5PMNr07ZAihzmBeiz5DasxwEhgx+2LkN+7sSQLs=
X-Received: by 2002:a9d:73d2:: with SMTP id
m18-v6mr2048002otk.332.1528857888625;
Tue, 12 Jun 2018 19:44:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a4a:6a89:0:0:0:0:0 with HTTP; Tue, 12 Jun 2018 19:44:47
-0700 (PDT)
In-Reply-To: <E06F947E-F077-4266-A93C-9904F6528BC7@jonasschnelli.ch>
References: <CABuOfuhMGFGc1tyjcOmnUk1OrWp2d6ppKc8phLT9pXCj8vs+qg@mail.gmail.com>
<FE65454B-B30A-4CEF-B568-B2746BD2BC0B@jonasschnelli.ch>
<E449A58B-08C4-4A1C-8109-38C800B718AF@jonasschnelli.ch>
<CAPg+sBiL9S29MV-cxrqGMeaWADO5-C3ejmxY21V_qUGHjhDHGw@mail.gmail.com>
<E06F947E-F077-4266-A93C-9904F6528BC7@jonasschnelli.ch>
From: Pieter Wuille <pieter.wuille@gmail.com>
Date: Tue, 12 Jun 2018 19:44:47 -0700
Message-ID: <CAPg+sBj352Tb2BjuO58qUsE__tM4tJkc1cnv8s6P4Vo_A3ixug@mail.gmail.com>
To: Jonas Schnelli <dev@jonasschnelli.ch>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM,
RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] New serialization/encoding format for key material
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Wed, 13 Jun 2018 02:44:50 -0000
On Sun, Jun 3, 2018 at 2:30 PM, Jonas Schnelli <dev@jonasschnelli.ch> wrote:
>> If there is interest, I can construct a code + implementation for any
>> of these in a few days probably, once the requirements are clear.
>
> Yes. Please.
Here is an example BCH code for base32 data which adds 27 checksum
characters, and can correct up to 7 errors occurring in strings up to
length 1023 (including the checksum characters themselves):
https://gist.github.com/sipa/d62f94faa1dcfd9ee4012d4c88955ba6
It can encode sequences of integers (between 0 and 31):
ref.py encode 13 7 22 23 11 29 21 15 3 26 20 26 4 7 6 11 19 1 6 8 31 13 4 19
> d8khta40r656y8xtnpxgldyne96vsfr83uch908se82g98rmnaa
Decode it again:
ref.py decode d8khta40r656y8xtnpxgldyne96vsfr83uch908se82g98rmnaa
> Decoded: 13 7 22 23 11 29 21 15 3 26 20 26 4 7 6 11 19 1 6 8 31 13 4 19
Or correct errors:
ref.py decode d8khta50r656y8xtmpxhlcyne96vsfr84udh908se82g98rmnat
> Errors found: d8khta?0r656y8xt?px?l?yne96vsfr8?u?h908se82g98rmna?
> Correction: d8khta40r656y8xtnpxgldyne96vsfr83uch908se82g98rmnaa
> Decoded: 13 7 22 23 11 29 21 15 3 26 20 26 4 7 6 11 19 1 6 8 31 13 4 19
The code above is just a randomly picked BCH code, and has no special
properties beyond the ones it is designed for.
I can easily generate similar code for BCH codes with different properties.
Cheers,
--
Pieter
|