Skip to content

Commit c6ab693

Browse files
committed
reformmated
1 parent 37ed0fd commit c6ab693

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

docs/HeaderSpec.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,56 @@
22

33
## Header format
44

5-
* The items in the header are as followed (square brackets representing the start and end of the header, anything in braces is related to the previous option). Newlines and tabs are not true, but simply for formatting:
5+
* At the start of the header, it is marked by 5 null characters (byte value 0000 0000), and then the following ASCII string: "BEGIN ENCRYPTION HEADER STRING"
6+
7+
* The end of the header is marked by the following ASCII string "END ENCRYPTION HEADER STRING", and followed by 5 null characters (byte value 0000 0000)
8+
9+
* The items in the header are as followed (square brackets representing the start and end of the header, anything in braces is related to the previous option). All whitespace but simply for formatting:
610

711
```
812
[
913
-HMAC:(hash here, None)
10-
{ -HASHALGO:(PBKDF2, SHA256, bcrypt) }
11-
{ -ITERATIONS:(iterations here) }
14+
{
15+
-HASHALGO:(PBKDF2, SHA256, bcrypt),
16+
-ITERATIONS:(iterations here)
17+
}
18+
1219
-KEYVERIFICATIONHASH:(hash here, None)
13-
{ -HASHALGO:(PBKDF2, SHA256, bcrypt) }
14-
{ -ITERATIONS:(iterations here) }
20+
{
21+
-HASHALGO:(PBKDF2, SHA256, bcrypt),
22+
-ITERATIONS:(iterations here)
23+
}
24+
1525
-ENCRYPTMODE:(AES, RSA, etc)
16-
{{-AESMODE:(ECB, CBC, CFB, CTR),
17-
-ECCMODE:(different curves fo here)}
18-
-KEYSIZE: (int)
19-
-BLOCKSIZE: (int)
26+
{
27+
-AESMODE:(ECB, CBC, CFB, CTR),
28+
-ECCMODE:(different curves fo here),
29+
-KEYSIZE:(int),
30+
-BLOCKSIZE:(int)
2031
}
21-
{ -IV:(IV here) }
32+
33+
-IV:(IV here)
2234
]
2335
```
2436

2537
## Header items
2638

27-
| Argument | Meaning | Values|
28-
| ------------------------------------------------------ |-------------------------------- | ------------------------------------ |
29-
| <a href="#HMAC">HMAC</a> | The verification hash used to confirm the file hasn't changed | 128 - 512 bit byte array (16-64 bytes) |
30-
| <a href="#KEYVERIFICATIONHASH">KEYVERIFICATIONHASH</a> | A hash of the key to verify if the password is correct | 128 - 512 bit byte array (16-64 bytes) |
31-
| <a href="#ENCRYPTMODE">ENCRYPTMODE</a> | A byte representing the encryption type | A string in the table of <a href="#ENCRYPTMODE">ENCRYPTMODE</a> page, and the (undefined ATM -- TODO) enumeration |
39+
* Subitems are in the hyperlinks
40+
41+
| Argument | Meaning | Values |
42+
| ------------------------------------------------------ |-------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
43+
| <a href="#HMAC">HMAC</a> | The verification hash used to confirm the file hasn't changed | 128 - 512 bit byte array (16-64 bytes) |
44+
| <a href="#KEYVERIFICATIONHASH">KEYVERIFICATIONHASH</a> | A hash of the key to verify if the password is correct | 128 - 512 bit byte array (16-64 bytes) |
45+
| <a href="#ENCRYPTMODE">ENCRYPTMODE</a> | A byte representing the encryption type | A string in the table of <a href="#ENCRYPTMODE">ENCRYPTMODE</a> page, and the (undefined ATM -- TODO) enumeration |
46+
| <a href="IV">IV</a> | The initialization vector used to start the encryption | 128 - 512 bit byte array (16-64 bytes) |
47+
3248

3349
### <p id="HMAC">HMAC</p>
3450

51+
* The HMAC (Hash Message Authentication Code)
52+
3553
### <p id="KEYVERIFICATIONHASH">KEYVERIFICATIONHASH</p>
3654

3755
### <p id ="ENCRYPTMODE">ENCRYPTMODE</P>
56+
57+
### <p id="IV">IV</p>

src/Backend/AESCryptoManager.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ public void AES_Encrypt(string iF, string oF, byte[] passwordBytes)
3333
cs.WriteByte((byte)data);
3434

3535
}
36-
37-
3836
}
39-
4037
}
4138

4239
public bool AES_Decrypt(string iF, string oF, byte[] passwordBytes)
@@ -79,8 +76,6 @@ public bool AES_Decrypt(string iF, string oF, byte[] passwordBytes)
7976
}
8077
return true;
8178
}
82-
8379
}
84-
8580
}
8681
}

0 commit comments

Comments
 (0)