README.md in miscreant-0.1.0 vs README.md in miscreant-0.2.0

- old
+ new

@@ -79,31 +79,28 @@ $ gem install miscreant ## API -### Miscreant::AES::SIV +### Miscreant::AEAD -The `Miscreant::AES::SIV` class provides the main interface to the **AES-SIV** +The `Miscreant::AEAD` class provides the main interface to the **AES-SIV** misuse resistant authenticated encryption function. -To make a new instance, pass in a 32-byte or 64-byte key. Note that these -options are twice the size of what you might be expecting (AES-SIV uses two -AES keys). +To make a new instance, pass in a binary-encoded 32-byte or 64-byte key. +Note that these options are twice the size of what you might be expecting +(AES-SIV uses two AES keys). -You can generate a random key using the `generate_key` method (default 32 bytes): - ```ruby -key_bytes = Miscreant::AES::SIV.generate_key -key = Miscreant::AES::SIV.new(key_bytes) -# => #<Miscreant::AES::SIV:0x007fe0109e85e8> +secret_key = Miscreant::AEAD.generate_key +encryptor = Miscreant::AEAD.new("AES-SIV", secret_key) ``` #### Encryption (#seal) -The `Miscreant::AES::SIV#seal` method encrypts a message along with a set of -*associated data* message headers. +The `Miscreant::AEAD#seal` method encrypts a binary-encoded message along with +a set of *associated data* message headers. It's recommended to include a unique "nonce" value with each message. This prevents those who may be observing your ciphertexts from being able to tell if you encrypted the same message twice. However, unlike other cryptographic algorithms where using a nonce has catastrophic security implications such as @@ -112,25 +109,35 @@ Example: ```ruby message = "Hello, world!" -nonce = SecureRandom.random_bytes(16) +nonce = Miscreant::AEAD.generate_nonce ciphertext = key.seal(message, nonce) ``` #### Decryption (#open) -The `Miscreant::AES::SIV#open` method decrypts a ciphertext with the given key. +The `Miscreant::AEAD#open` method decrypts a binary-encoded ciphertext with the +given key. Example: ```ruby message = "Hello, world!" -nonce = SecureRandom.random_bytes(16) +nonce = Miscreant::AEAD.generate_nonce ciphertext = key.seal(message, nonce) plaintext = key.open(ciphertext, nonce) ``` + +## Code of Conduct + +We abide by the [Contributor Covenant][cc] and ask that you do as well. + +For more information, please see [CODE_OF_CONDUCT.md]. + +[cc]: https://contributor-covenant.org +[CODE_OF_CONDUCT.md]: https://github.com/miscreant/miscreant/blob/master/CODE_OF_CONDUCT.md ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/miscreant/miscreant