summaryrefslogtreecommitdiff
path: root/0b/3cebe7133b6e25958e38315532c7b10c544d41
blob: bec59f9f90eff9844688e1173d4d37f86a694677 (plain)
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
Return-Path: <bitcoin-dev@wuille.net>
Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 1F160C013A
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 19 Jan 2021 17:57:16 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by fraxinus.osuosl.org (Postfix) with ESMTP id 0D8F685475
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 19 Jan 2021 17:57:16 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from fraxinus.osuosl.org ([127.0.0.1])
 by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id FpdMwEtryAWR
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 19 Jan 2021 17:57:14 +0000 (UTC)
X-Greylist: from auto-whitelisted by SQLgrey-1.7.6
Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch
 [185.70.40.131])
 by fraxinus.osuosl.org (Postfix) with ESMTPS id 5742D85462
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 19 Jan 2021 17:57:14 +0000 (UTC)
Date: Tue, 19 Jan 2021 17:57:08 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wuille.net;
 s=protonmail2; t=1611079031;
 bh=RlI3VcwlX0oMkXdkF2NOhnFH6oI20yVt9hvp4qAxRj4=;
 h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From;
 b=n5Rav/lHkBpXw6gKwmHIsJ5QMXniPDnbQJ9FW33pp73A8NEa8G5eOuJ05OnN3ax+K
 8x7IJkV9LwPBWni8TnLxwTKOL60pMcpQBpmGzlwixnGDs0Jrj/dI7ov7qHivE6eLKf
 BHqV+HTL7lrXxTFDCjUWEjVPECoq1p3+CC7A1dUtemHyHFyVQqgiO4XdHETbsZhyEA
 ydVGgM2m7AFX40nuKwngM5FiMwQb2VWoxjmZkGSZbAAlsr9XgcNcMWqs9qMEupkMD7
 q5MLl+m9qsZwXj5okd+vVRLIf+eqAgjvdKZcTmYIsQOdcVep5b4PmQ48sN1kkhBOwK
 FHLc4dUJ1DPBw==
To: nakagat <nakagat@gmail.com>
From: Pieter Wuille <bitcoin-dev@wuille.net>
Reply-To: Pieter Wuille <bitcoin-dev@wuille.net>
Message-ID: <ER4Y1yqunl3NMmLFDYpDeXsw-MhtS3KBmSTnDQib7yVXas_HGoD7GgOPcQ6v0lSr9BG2ntXoYW4kEKiZ0VdDgecwxJOLMAvuIpUzbCpM6WI=@wuille.net>
In-Reply-To: <CAHk9a9egxmTQqSLs9PUuH1L8q_c7hp_oo4jT1+BP0ga=aFCPhQ@mail.gmail.com>
References: <jfRUzc8uB5fpIQy-a_TfTwjAD4FMtf2eInfHdgZRoLwc0NdTv7srnRLtmwFHPLInJfglSzOXXe0SVR3cgHejGPi0Kwl81UV_wkwVJcQi1rA=@wuille.net>
 <CAHk9a9d_xm2nO1t5GsLJiny1V3H=uv8jGuUTywQetZQOXxyG9w@mail.gmail.com>
 <N9ny4XfpI4SATvCXSKO_ns03ONm4p17tAGXxInoXIe16S7zfH6b8Uj2SkS-pL5sEEp7Wpyi0RZ8J92WZPDeHYKBBuq1xnV6eEUbKouej-TU=@wuille.net>
 <CAHk9a9egxmTQqSLs9PUuH1L8q_c7hp_oo4jT1+BP0ga=aFCPhQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Bech32m BIP: new checksum,
	and usage for segwit address
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
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: Tue, 19 Jan 2021 17:57:16 -0000

On Sunday, January 17, 2021 9:59 PM, nakagat <nakagat@gmail.com> wrote:

> I thought that BECH32M_CONST could be created from hrp and data
> instead of constants.
>
> I thought that the error position would be the same as bech32 by
> recalculating the value created from hrp and data.

So, bech32 can be written as:

* checksum =3D polymod(expand(hrp) + data) xor 1

Bech32m changes that to:

* checksum =3D polymod(expand(hrp) + data) xor 0x2bc830a3

I believe that your idea is:

* checksum =3D polymod(expand(hrp) + data) xor hash(hrp, data)

That has exactly the same error detecting capabilities as:

* checksum =3D hash(hrp, data)

The hashing makes all types of errors uniform, and it doesn't matter what o=
ther things are added to the checksum. Once you hash the data, the checksum=
 is uniformly random, and you can't make it "less random" anymore.

In this case, we *want* non-uniformity. The polymod function as a checksum =
detects some kinds of errors much better than others, and this is what we w=
ant.

Does that clarify things?

Cheers,

--
Pieter