Commit dd3b6d9f authored by Éloïs's avatar Éloïs
Browse files

[RFC17] fix: encryption algo is incorrect

parent a6e8004b
......@@ -104,17 +104,19 @@ Let `t` the message type.
1. Compute `l = m.lenght`
1. Generate a random integer `x` between `0` and `170 - l`
1. Generate `x` random bytes and add them at end of `m`.
1. compute `L = l + x`
1. compute `L = l + x + 1`
1. compute `Si'` and `Pr'`.
1. Create a bytes array `dataToEncrypt` of length `L`
1. Push the byte `l` in `dataToEncrypt`
1. Append `m` to `dataToEncrypt`
1. Compute `R = crypto_box_beforenm(Si', Pr')`
1. Generate symmetric encryption key `k = scrypt(R, salt: nonce, N: 1024, r: 8, p: 1, dkLen: L)`
1. compute `encryptedMessage = m ^ k`
1. compute `encryptedData = dataToEncrypt ^ k`
1. Create a bytes array `b` of length `L + 20`
1. Fill the three first bytes of `b` with content `0x27b601`
1. Push the byte `t` in `b`
1. Append `nonce` to `b`
1. Push the byte `l` in `b`
1. Append `m` to `b`
1. Append `encryptedData` to `b`
1. Compute `source = base64.encode(b)`
1. Write `source` in a comment field of transaction document
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment