@@ -75,6 +88,10 @@ Future versions of the present format must increment this byte.
...
@@ -75,6 +88,10 @@ Future versions of the present format must increment this byte.
| 0x00 | For a human |
| 0x00 | For a human |
| 0x01 | For a machine |
| 0x01 | For a machine |
### Nonce
An sequence of 16 random bytes to use as scrypt salt
### Real message length
### Real message length
Indicates the real size of the message in bytes. That is, the number of bytes that should be interpreted as an UTF8 string. There may be extra bytes, the extra bytes should be ignored (see section "Random extra bytes").
Indicates the real size of the message in bytes. That is, the number of bytes that should be interpreted as an UTF8 string. There may be extra bytes, the extra bytes should be ignored (see section "Random extra bytes").
...
@@ -100,7 +117,7 @@ There are at least 21 bytes of metadata, so the maximum size of a message is **1
...
@@ -100,7 +117,7 @@ There are at least 21 bytes of metadata, so the maximum size of a message is **1
Let `m` the user message bytes encoded in UTF8.
Let `m` the user message bytes encoded in UTF8.
Let `t` the message type.
Let `t` the message type.
1. Generate 16 random bytes a stores them in a byte array `nonce`.
1. Generate 16 random bytes and stores them in a byte array `nonce`.
1. Compute `l = m.lenght`
1. Compute `l = m.lenght`
1. Generate a random integer `x` between `0` and `170 - l`
1. Generate a random integer `x` between `0` and `170 - l`
1. Generate `x` random bytes and add them at end of `m`.
1. Generate `x` random bytes and add them at end of `m`.
...
@@ -124,7 +141,7 @@ Let `t` the message type.
...
@@ -124,7 +141,7 @@ Let `t` the message type.
Let `source` a base64 string read from comment field of a transaction document.
Let `source` a base64 string read from comment field of a transaction document.
1.compute `b = base64.decode(source)`
1.Compute `b = base64.decode(source)`
1. Ensure that `b.length >= 3`
1. Ensure that `b.length >= 3`
1. Ensure that `b[0] = 0x27` and `b[1] = 0xb6` (magic value check)
1. Ensure that `b[0] = 0x27` and `b[1] = 0xb6` (magic value check)
1. Ensure that `b[2] = 0x01` (version check)
1. Ensure that `b[2] = 0x01` (version check)
...
@@ -133,14 +150,29 @@ Let `source` a base64 string read from comment field of a transaction document.
...
@@ -133,14 +150,29 @@ Let `source` a base64 string read from comment field of a transaction document.
1. compute `Sr'` and `Pi'`.
1. compute `Sr'` and `Pi'`.
1. Compute `R = crypto_box_beforenm(Sr', Pi')`
1. Compute `R = crypto_box_beforenm(Sr', Pi')`
1. compute `L = b.length - 20`
1. compute `L = b.length - 20`
1.Let`nonce` a bytes array from `b[4]` to `b[19]`
1.Read`nonce`: the bytes array from `b[4]` to `b[19]`