Commit 3d904ca3 authored by Vincent Texier's avatar Vincent Texier
Browse files

Improve presentation with tables and fix some markdown bugs

parent f05b87c6
......@@ -36,10 +36,11 @@ DEWIF is an inter-operable and secure format for any DUBP wallet.
DEWIF format is a base64 string.
This base64 string encodes a sequence of bytes whose structure is defined below.
## dewif bytes structure
## Dewif bytes structure
| version (4 bytes) | currency code (4 bytes) | version data (any bytes) |
| Version | Currency code | Version data |
|:-----------------:|:-----------------------:|:------------------------:|
| 4 bytes | 4 bytes | Any bytes |
## Version
......@@ -47,55 +48,57 @@ The 4 bytes of the version field must be interpreted as an unsigned integer enco
## Currencies code
| Currency | code |
| Currency | Code |
|:---------|:-----------|
| None | 0x00000000 |
| Ğ1 | 0x00000001 |
| Ğ1-Test | 0x10000001 |
## version data
## Version data
### v1
### Version 1
v3 data :
| `log N` | `Algorithm` | `Encrypted data` |
|:-------:|:-----------:|:----------------:|
| 1 byte | 1 byte | 64 bytes |
| log N | Algorithm | Encrypted data |
|:---------:|:-----------:|:---------------:|
| 1 byte | 1 byte | 64 bytes |
#### Algorithm
| Algorithm | code |
| Algorithm | Code |
|:----------------|:-----|
| [Ed25519] | 0x00 |
| [BIP32-Ed25519] | 0x01 |
| Unknown* | 0x02 |
*Future algorithms can be added to DEWIF v1 if their seed and public key are the same size.
* Future algorithms can be added to DEWIF v1 if their seed and public key are the same size.
#### Encrypted data
| seed(32 bytes) | public key(32bytes) |
|:--------------:|:-------------------:|
| seed bytes | public key bytes |
| Seed | Public key |
|:-------------:|:-------------:|
| 32 bytes | 32 bytes |
The public key serves as a checksum. To check that the DEWIF base64 string is not corrupted, simply generate a keypair with the seed and check that the obtained public key matches.
Symmetric encryption algorithm : aes256
**Symmetric encryption algorithm:** aes256
aes256 key: scrypt of user passphrase with the following parameters:
**AES256 key** = scrypt of user passphrase with the following parameters:
**password:** passphrase
**salt:** sha256("dewif" ++ passphrase)
**N:** `2^(log N)`
**r:** 16
**p:** 1
| Parameter | Value |
|:--------------:|:----------------------------:|
|**Password:** | passphrase |
|**Salt** |sha256("dewif" ++ passphrase) |
|**N** |`2^(log N)` |
|**r** |16 |
|**p** |1 |
Example 1:
**Example 1:**
**log N** = 15
**Algorithm:** Ed25519
**keypair seed:** 0xbfa3f6e322cf21d0e652f79a69df9498fdf5347665e5646d9041f756496a1143
| Parameter | Value |
|:-----------------:|:----------------------------:|
|**Log N** | 15|
|**Algorithm** |Ed25519|
|**Keypair seed** | 0xbfa3f6e322cf21d0e652f79a69df9498fdf5347665e5646d9041f756496a1143 |
```txt
0x000000001 #v1
......@@ -106,21 +109,27 @@ Example 1:
0x17df9d2b059cdd2825955691e3a783e6da403148ddebb1144d1a9b9e545f2371 # public key
```
aes256 key generated from scrypt with the following parameters:
**AES256 key generated from scrypt with the following parameters:**
| Parameter | Value |
|:-----------------:|:----------------------------:|
|**N** | `2^12 = 4096` |
|**r** |16|
|**p** | 1 |
**N:** `2^12 = 4096`
**r:** 16
**p:** 1
DEWIF base 64 string (with aes key `"toto titi tata"`):
`AAAAARAAAAEMAJ8UMCz6NVliR+EGUdlnZ8RAi8GqcbXqDn7TZxjXzBI6NbRxSDYlXdJRMlg3YKttB5EPAZrNafNIUGmFyEyaIvQ=`
Example 2:
**Example 2:**
| parameter | value |
|:-----------------:|:----------------------------:|
|**Log N** | 15|
|**Algorithm** |Bip32-Ed25519|
|**Keypair seed** | 0xb7d3a54e1c20172cd38e0d803776a3bacf11f895ef8ef846043a0d628431c872 |
**log N** = 15
**Algorithm:** Bip32-Ed25519
**keypair seed:** 0xb7d3a54e1c20172cd38e0d803776a3bacf11f895ef8ef846043a0d628431c872
```txt
0x000000001 #v1
......@@ -131,11 +140,13 @@ Example 2:
0xd1fec6ddf6e887e40bd77d459131ee5a6bec1194341b9393ead606363bb7b060 # public key
```
aes256 key generated from scrypt with the following parameters:
**AES256 key generated from scrypt with the following parameters:**
**N:** `2^15 = 32768`
**r:** 16
**p:** 1
| Parameter | Value |
|:-----------------:|:----------------------------:|
|**N** | `2^15 = 32768` |
|**r** |16|
|**p** | 1 |
DEWIF base 64 string (with aes key `"toto titi tata"`):
......
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