https://github.com/nuxed/crypto
The Nuxed Crypto component provides a high-level cryptography interface that relies on libsodium for all of its underlying cryptography operations.
https://github.com/nuxed/crypto
argon2 authentication constant-time cryptography cryptography-library curve25519 digital-signature ed25519 encryption hack hacklang hhvm libsodium misuse-resistant nuxed password-hashing poly1305 x25519 xsalsa20
Last synced: about 18 hours ago
JSON representation
The Nuxed Crypto component provides a high-level cryptography interface that relies on libsodium for all of its underlying cryptography operations.
- Host: GitHub
- URL: https://github.com/nuxed/crypto
- Owner: nuxed
- License: mit
- Created: 2019-10-19T23:13:26.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2020-11-21T22:50:51.000Z (about 5 years ago)
- Last Synced: 2025-07-22T12:54:24.328Z (6 months ago)
- Topics: argon2, authentication, constant-time, cryptography, cryptography-library, curve25519, digital-signature, ed25519, encryption, hack, hacklang, hhvm, libsodium, misuse-resistant, nuxed, password-hashing, poly1305, x25519, xsalsa20
- Language: Hack
- Homepage:
- Size: 113 KB
- Stars: 4
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README




[](https://packagist.org/packages/nuxed/crypto)
[](https://packagist.org/packages/nuxed/crypto)
[](https://packagist.org/packages/nuxed/crypto)
# Nuxed Crypto
The Nuxed Crypto component provides a high-level cryptography interface that relies on libsodium for all of its underlying cryptography operations.
inspired by [`Halite`](https://github.com/paragonie/halite).
### Important
Although this library has developed with care, it has not been examined by security experts, there will always be a chance that we overlooked something. Please ask your favourite trusted hackers to hammer it for implementation errors and bugs before even thinking about deploying it in production.
### Installation
This package can be installed with [Composer](https://getcomposer.org).
```console
$ composer require nuxed/crypto
```
### Example
```hack
use namespace Nuxed\{Crypto, Filesystem};
use namespace Nuxed\Crypto\Symmetric;
<<__EntryPoint>>
async function main(): Awaitable {
// generate a key :
$key = Symmetric\Encryption\Key::generate();
// or load a stored encryption key :
$file = new Filesystem\File('/path/to/encryption.key');
$key = $key = Symmetric\Encryption\Key::import(
new Crypto\HiddenString(await $file->read())
);
$message = new Crypto\HiddenString('Hello, World!');
$ciphertext = Symmetric\Encryption\encrypt($message, $key);
$plaintext = Symmetric\Encryption\decrypt($ciphertext, $key);
print $plaintext->toString(); // Hello, World!
}
```
---
### Security
For information on reporting security vulnerabilities in Nuxed, see [SECURITY.md](SECURITY.md).
---
### License
Nuxed is open-sourced software licensed under the MIT-licensed.