diff options
| -rw-r--r-- | README.md | 15 |
1 files changed, 9 insertions, 6 deletions
| @@ -149,16 +149,18 @@ Operation: | |||
| 149 | 149 | ||
| 150 | - produce a 2 byte string (N) indicating the length of P | 150 | - produce a 2 byte string (N) indicating the length of P |
| 151 | 151 | ||
| 152 | - if the length of P < L, produce L - P bytes of random data (R), N = "%02d" | 152 | - generate random padding and set N: |
| 153 | if the length of P >= L, N = "-1" | 153 | - if the length of P < L, produce L - P bytes of random data (R), N = "%02d" |
| 154 | - if the length of P >= L, N = "-1" | ||
| 154 | 155 | ||
| 155 | - produce a hash digest (H): H = SHA_256(N + P + R (if the length of P < L)) | 156 | - produce a hash digest (H): H = SHA_256(N + P + R (if the length of P < L)) |
| 156 | 157 | ||
| 157 | - encrypt (E): E = AES_256_CFB_ENCRYPT(H + N + P + R (if the length of P < L), K) | 158 | - encrypt (E): E = AES_256_CFB_ENCRYPT(H + N + P + R (if the length of P < L), K) |
| 158 | 159 | ||
| 159 | - B = mpes1:BASE64_ENCODE(S + E) | 160 | - B = mpes1:BASE64_ENCODE(S + E) |
| 160 | example: | 161 | |
| 161 | mpes1:vo7lsIpD7i6byBA6+vlUoF4OVDfEe+aYRRk4FRtfJ2gMY8M43Kj6WfdfgbViIOl83bI4XEc96okhPW5Mla813aAR1gbPjDg0xmCyIbWOiUv/dg== | 162 | example: |
| 163 | mpes1:vo7lsIpD7i6byBA6+vlUoF4OVDfEe+aYRRk4FRtfJ2gMY8M43Kj6WfdfgbViIOl83bI4XEc96okhPW5Mla813aAR1gbPjDg0xmCyIbWOiUv/dg== | ||
| 162 | 164 | ||
| 163 | 165 | ||
| 164 | #### Decryption | 166 | #### Decryption |
| @@ -192,8 +194,9 @@ Operation: | |||
| 192 | 194 | ||
| 193 | - extract the next 2 bytes for the length of P (N): N = D[16 : 17] | 195 | - extract the next 2 bytes for the length of P (N): N = D[16 : 17] |
| 194 | 196 | ||
| 195 | - if N == "-1" the password is the remaining bytes of D: P = D[18 :] | 197 | - fetch the plain-text: |
| 196 | if N != "-1", extract the next N-bytes from D: P = D[18 : (18 + N)] | 198 | - if N == "-1" the password is the remaining bytes of D: P = D[18 :] |
| 199 | - if N != "-1", extract the next N-bytes from D: P = D[18 : (18 + N)] | ||
| 197 | 200 | ||
| 198 | 201 | ||
| 199 | ### Limitations | 202 | ### Limitations |
