Skip to content

Commit

Permalink
README and docblock updates for Str::encrypt() and Str::decrypt() met…
Browse files Browse the repository at this point in the history
…hods
  • Loading branch information
PHLAK committed Jul 17, 2018
1 parent c9394dd commit d116a40
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -893,14 +893,19 @@ $string->bcrypt(['salt' => 'NaClNaClNaClNaClNaClNaCl']); // Returns '$2y$10$NaCl
> Encrypt the string.
```php
Twine\Str::encrypt( string $key, [ string $cipher = 'aes-128-gcm' ] ) : Twine\Str
Twine\Str::encrypt( string $key, [ string $cipher = 'AES-128-CBC' ] ) : Twine\Str
```

| Parameter | Description |
| --------- | ---------------------- |
| `$key` | The key for encrypting |
| `$cipher` | The cipher method |

Supported cipher methods:

- `AES-128-CBC` (default)
- `AES-256-CBC`

#### Example

```php
Expand All @@ -915,14 +920,19 @@ $string->encrypt('secret'); // Returns something like '$DZpEm9ZFec9ybxF7$y2rc62E
> Decrypt the string.
```php
Twine\Str::decrypt( string $key, [ string $cipher = 'aes-128-gcm' ] ) : Twine\Str
Twine\Str::decrypt( string $key, [ string $cipher = 'AES-128-CBC' ] ) : Twine\Str
```

| Parameter | Description |
| --------- | ---------------------- |
| `$key` | The key for decrypting |
| `$cipher` | The cipher method |

Supported cipher methods:

- `AES-128-CBC` (default)
- `AES-256-CBC`

#### Example

```php
Expand Down
8 changes: 4 additions & 4 deletions src/Traits/Encryptable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ trait Encryptable
* Encrypt the string.
*
* @param string $key The key for encrypting
* @param string $cipher The cipher method (default: 'AES-128-CBC')
* @param string $cipher The cipher method
*
* Supported cipher methods:
*
* - AES-128-CBC
* - AES-128-CBC (default)
* - AES-256-CBC
*
* @throws \PHLAK\Twine\Exceptions\EncryptionException
Expand Down Expand Up @@ -56,11 +56,11 @@ public function encrypt(string $key, string $cipher = 'AES-128-CBC') : self
* Decrypt the string.
*
* @param string $key The key for decrypting
* @param string $cipher The cipher method (default: 'AES-128-CBC')
* @param string $cipher The cipher method
*
* Supported cipher methods:
*
* - AES-128-CBC
* - AES-128-CBC (default)
* - AES-256-CBC
*
* @throws \PHLAK\Twine\Exceptions\DecryptionException
Expand Down

0 comments on commit d116a40

Please sign in to comment.