From a92d2e2edd3251067ab8787ecf10ee2dffe2b85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=8E=9F=E6=99=B4=E5=A4=AA?= Date: Fri, 6 Dec 2024 11:26:23 +0000 Subject: [PATCH] Clarify the units --- 44.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/44.md b/44.md index b70acb2..8f27fed 100644 --- a/44.md +++ b/44.md @@ -86,7 +86,7 @@ NIP-44 version 2 has the following design characteristics: - Content must be encoded from UTF-8 into byte array - Validate plaintext length. Minimum is 1 byte, maximum is 65535 bytes - Padding format is: `[plaintext_length: u16][plaintext][zero_bytes]` - - Padding algorithm is related to powers-of-two, with min padded msg size of 32 + - Padding algorithm is related to powers-of-two, with min padded msg size of 32bytes - Plaintext length is encoded in big-endian as first 2 bytes of the padded blob 5. Encrypt padded content - Use ChaCha20, with key and nonce from step 3 @@ -148,8 +148,8 @@ validation rules, refer to BIP-340. - `x[i:j]`, where `x` is a byte array and `i, j <= 0` returns a `(j - i)`-byte array with a copy of the `i`-th byte (inclusive) to the `j`-th byte (exclusive) of `x`. - Constants `c`: - - `min_plaintext_size` is 1. 1b msg is padded to 32b. - - `max_plaintext_size` is 65535 (64kb - 1). It is padded to 65536. + - `min_plaintext_size` is 1. 1bytes msg is padded to 32bytes. + - `max_plaintext_size` is 65535 (64kB - 1). It is padded to 65536bytes. - Functions - `base64_encode(string)` and `base64_decode(bytes)` are Base64 ([RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), with padding) - `concat` refers to byte array concatenation