Skip to content

Commit 3f4ca08

Browse files
ixjeErik Zhang
authored and
Erik Zhang
committed
Amend NEP-2 (neo-project#17)
* Amend Decryption steps decryption results in a plaintext key, not encrypted key * amend Encryption steps Make text more consistent by using the actual name provided in step 1. The name ‘salt’ is only relevant for the scrypt function, not for the actual final key data structure. It also more closely matches the actual implementation @ https://github.com/neo-project/neo/blob/master/neo/Wallets/KeyPair.cs#L7 5
1 parent fb19052 commit 3f4ca08

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nep-2.mediawiki

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ To keep the size of the encrypted key down, no initialization vectors (IVs) are
7171
7272
#Derive a key from the passphrase using scrypt
7373
74-
#*Parameters: passphrase is the passphrase itself encoded in UTF-8 and normalized using Unicode Normalization Form C (NFC). salt is addresshash from the earlier step, n=16384, r=8, p=8, length=64
74+
#*Parameters: passphrase is the passphrase itself encoded in UTF-8 and normalized using Unicode Normalization Form C (NFC). Salt is the addresshash from the earlier step, n=16384, r=8, p=8, length=64
7575
7676
#*Let's split the resulting 64 bytes in half, and call them derivedhalf1 and derivedhalf2.
7777
@@ -81,17 +81,17 @@ To keep the size of the encrypted key down, no initialization vectors (IVs) are
8181
8282
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:
8383
84-
*0x01 0x42 + flagbyte + salt + encryptedhalf1 + encryptedhalf2
84+
*0x01 0x42 + flagbyte + addresshash + encryptedhalf1 + encryptedhalf2
8585
8686
===Decryption steps===
8787
8888
#Collect encrypted private key and passphrase from user.
8989
9090
#Derive derivedhalf1 and derivedhalf2 by passing the passphrase and addresshash into scrypt function.
9191
92-
#Decrypt encryptedhalf1 and encryptedhalf2 using AES256Decrypt, merge them to form the encrypted private key.
92+
#Decrypt encryptedhalf1 and encryptedhalf2 using AES256Decrypt, merge the two parts and XOR the result with derivedhalf1 to form the plaintext private key.
9393
94-
#Convert that private key into a NEO address.
94+
#Convert that plaintext private key into a NEO address.
9595
9696
#Hash the NEO address, and verify that addresshash from the encrypted private key record matches the hash. If not, report that the passphrase entry was incorrect.
9797

0 commit comments

Comments
 (0)