Fix typo in readme
This commit is contained in:
parent
3978bb6b18
commit
b873c13bf2
14
readme.md
14
readme.md
@ -62,10 +62,10 @@ std::cout << decrypted << std::endl;
|
|||||||
using namespace Leonetienne::GCrypt;
|
using namespace Leonetienne::GCrypt;
|
||||||
|
|
||||||
// Encrypt
|
// Encrypt
|
||||||
GCryptWrapper::EncryptFile("main.cpp", "main.cpp.crypt", Key::FromPassword("password1"));
|
GWrapper::EncryptFile("main.cpp", "main.cpp.crypt", Key::FromPassword("password1"));
|
||||||
|
|
||||||
// Decrypt
|
// Decrypt
|
||||||
GCryptWrapper::DecryptFile("main.cpp.crypt", "main.cpp.clear", Key::FromPassword("password1"));
|
GWrapper::DecryptFile("main.cpp.crypt", "main.cpp.clear", Key::FromPassword("password1"));
|
||||||
```
|
```
|
||||||
|
|
||||||
### Prefer keyfiles instead?
|
### Prefer keyfiles instead?
|
||||||
@ -76,7 +76,7 @@ using namespace Leonetienne::GCrypt;
|
|||||||
const Key newKey = Key::Random(); // Will create a key from actual randomness (like, hardware events)
|
const Key newKey = Key::Random(); // Will create a key from actual randomness (like, hardware events)
|
||||||
|
|
||||||
// Use the key
|
// Use the key
|
||||||
GCryptWrapper::EncryptFile("main.cpp", "main.cpp.crypt", newKey);
|
GWrapper::EncryptFile("main.cpp", "main.cpp.crypt", newKey);
|
||||||
|
|
||||||
// Save the key to a keyfile
|
// Save the key to a keyfile
|
||||||
newKey.WriteToFile("/var/stuff/mykeyfile");
|
newKey.WriteToFile("/var/stuff/mykeyfile");
|
||||||
@ -93,7 +93,7 @@ This way you could, for example, decrypt an ecrypted file directly into memory.
|
|||||||
Without saying, this is more advanced and not as-easy as the methods supplied in the wrapper.
|
Without saying, this is more advanced and not as-easy as the methods supplied in the wrapper.
|
||||||
|
|
||||||
---
|
---
|
||||||
<sup>\*</sup> A key is always of size `BLOCK_SIZE`. The default block size is 512 (bit), but you can easily change it in [Config.h](https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/GCryptLib/include/GCrypt/Config.h) or wherever it'll be put in the INCLUDE/\*.cpp. `BLOCK_SIZE` is also the minimal output length!
|
<sup>\*</sup> A key is always of size `BLOCK_SIZE`. The default block size is 512 (bit), but you can easily change it in [Config.h](https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/GCryptLib/include/GCrypt/Config.h).
|
||||||
|
|
||||||
## The deets 🍝
|
## The deets 🍝
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ GHash is a streaming hash function based on the GCipher.
|
|||||||
For all intents and purposes, it does the following:
|
For all intents and purposes, it does the following:
|
||||||
You have a *Block b*, which is initialized with a static random distribution.
|
You have a *Block b*, which is initialized with a static random distribution.
|
||||||
Once you give the GHash instance a data block to digest, it will use the GCipher to encrypt it, with itself as a key, and xor that onto *b*.
|
Once you give the GHash instance a data block to digest, it will use the GCipher to encrypt it, with itself as a key, and xor that onto *b*.
|
||||||
(*b<sub>i</sub> = b<sub>i-1</sub> ⊕ E(key=b, data=k)*)
|
(*b<sub>i</sub> = b<sub>i-1</sub> ⊕ E(key=b, data=b)*)
|
||||||
|
|
||||||
The lastest *b* represents the current result of the hash function.
|
The lastest *b* represents the current result of the hash function.
|
||||||
|
|
||||||
@ -122,8 +122,8 @@ This wrapper function adds an additional block including the length of the input
|
|||||||
Whilst we're at it, why not implement a pseudo-random number generator based on GHash aswell. So here it is, [GPrng](https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/feature/relaunch/GCryptLib/include/GCrypt/GPrng.h).
|
Whilst we're at it, why not implement a pseudo-random number generator based on GHash aswell. So here it is, [GPrng](https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/feature/relaunch/GCryptLib/include/GCrypt/GPrng.h).
|
||||||
GPrng is really nothing special. I just wanted to implement it, mainly to visualize the GCiphers entropy.
|
GPrng is really nothing special. I just wanted to implement it, mainly to visualize the GCiphers entropy.
|
||||||
|
|
||||||
GPrng basically does the following: It creates a GHash instance, which initially digested the prngs seed. This produces a hash result, which is one block in size.
|
GPrng basically does the following: It creates a GHash instance, which initially digests the prngs seed. This produces a hash result, which is one block in size.
|
||||||
This block gets eaten up, as pseudo-randomness is used. Once there are no bits left, the GHash instance will digest the result of this block ⊕ seed.
|
This block gets eaten up, as pseudo-randomness is used. Once there are no bits left, the GHash instance will digest the result of this block ⊕ the initial seed.
|
||||||
The xor operation ensures that an observer will never know the internal state of the GHash instance. This is important, as to ensure an observer won't be able to predict
|
The xor operation ensures that an observer will never know the internal state of the GHash instance. This is important, as to ensure an observer won't be able to predict
|
||||||
future output.
|
future output.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user