NullSablex/pawn-crypto
Cryptography plugin for SA-MP and open.mp, written in Rust.
Fügt seine Include-Dateien samt der Bibliotheken, von denen es abhängt, dem Pawn-Compiler in deinem Browser hinzu, bereit zum Einbinden in ein Skript.
README.md
pawn-crypto
Cryptography plugin for SA-MP and Open Multiplayer, written in Rust — by NullSablex
English | Português (Brasil)
Overview
pawn-crypto provides SHA-2 hashing, HMAC authentication and asynchronous Argon2id password hashing for SA-MP and Open Multiplayer. Built with rust-samp and RustCrypto.
The Pawn include is crypto.inc. The same default binary exposes the SA-MP
plugin interface and the native open.mp component interface.
Features
| Operation | API | Execution |
|---|---|---|
| SHA-224, SHA-256, SHA-384, SHA-512 | crypto_sha224 / 256 / 384 / 512 | Synchronous, lowercase hexadecimal output. |
| HMAC-SHA-256, HMAC-SHA-512 | crypto_hmac_sha256 / 512 and _verify | Synchronous, full tags and constant-time verification. |
| Argon2id | crypto_argon2id_hash, crypto_argon2id_verify | Bounded workers, random salts, PHC strings and Pawn callbacks. |
The API accepts packed or unpacked Pawn strings. Message, key and password bytes are preserved up to the first null byte without text decoding or normalization. HMAC and Argon2id are distinct operations: use the password API for password storage.
Installation
- Download
pawn_crypto.so(Linux) orpawn_crypto.dll(Windows) andcrypto.incfrom Releases, or build from source. - Copy
crypto.incinto your Pawn include directory, such aspawno/include/orqawno/include/. - Load the binary using one mode:
- SA-MP: place it in
plugins/and addpawn_crypto.soon Linux orpawn_cryptoon Windows to thepluginsline inserver.cfg. - open.mp native: place it in
components/; the server loads it automatically. - open.mp legacy: place it in
plugins/and addpawn_cryptotopawn.legacy_pluginsinconfig.json.
- SA-MP: place it in
See installation for the configuration examples.
Quick start
#include <a_samp>
#include <crypto>
public OnFilterScriptInit()
{
new digest[CRYPTO_SHA256_LENGTH + 1];
if (crypto_sha256("abc", digest))
{
printf("SHA-256: %s", digest);
}
return 1;
}
For PascalCase, install and include crypto_omp.inc instead and call
Crypto_Sha256. It provides Pawn aliases to the same natives. Choose one naming
include per script; either style works on SA-MP and open.mp.
Documentation
Read the online documentation, or browse the Markdown overview on GitHub.
| Guide | Contents |
|---|---|
| Installation | Binary placement and server configuration. |
| SHA-2 | Data digests and output buffers. |
| HMAC | Message authentication and tag verification. |
| Argon2id | Password storage, callbacks and resource limits. |
| API reference | Native signatures, aliases, constants and return values. |
| Errors | Submission failures, callback results and troubleshooting. |
| Security | Data handling, secrets and application responsibilities. |
| Building | Toolchain, build scripts and validation commands. |
| Dependency licenses | cargo-about inventories and third-party notices. |
Examples
The examples cover SHA-2, HMAC and asynchronous Argon2id in
both naming styles. Each .pwn file is a runnable filterscript.
Building from source
Use the Rust toolchain pinned in rust-toolchain.toml.
The build scripts produce dist/pawn_crypto.so and dist/pawn_crypto.dll:
./scripts/build-linux.sh
./scripts/build-windows.sh
See the build guide for platform requirements and cross-compilation setup.
Contributing
See CONTRIBUTING.md for development and review requirements.
Each contributor's Signed-off-by certifies the DCO and accepts the
CLA under the contribution policy. Participation follows the
Code of Conduct and AI usage policy.
Report vulnerabilities privately as described in SECURITY.md. Changes are recorded in CHANGELOG.md.
License
Copyright (c) 2026 NullSablex
Licensed under the Apache License, Version 2.0. Third-party dependencies retain their own licenses and notices; see the dependency license guide.
argon2idcryptographyhmacopen-mppassword-hashingpawnpluginrustrust-sampsa-mpsampsha2
Diese Seite wird aus dem erstellt, was GitHub über das Repository veröffentlicht. samp.directory hostet den Code nicht. Ein Problem mit diesem Eintrag melden