samp.directory
← Скрипты и библиотеки

NullSablex/pawn-crypto

Cryptography plugin for SA-MP and open.mp, written in Rust.

Плагин★ 0обновлён 16 часов назадApache-2.0Rust
Открыть на GitHub
Попробовать в компиляторе Pawn →

Добавляет файлы инклудов этого репозитория вместе с библиотеками, от которых он зависит, в компилятор Pawn в вашем браузере, чтобы их можно было сразу подключить в скрипте.

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

OperationAPIExecution
SHA-224, SHA-256, SHA-384, SHA-512crypto_sha224 / 256 / 384 / 512Synchronous, lowercase hexadecimal output.
HMAC-SHA-256, HMAC-SHA-512crypto_hmac_sha256 / 512 and _verifySynchronous, full tags and constant-time verification.
Argon2idcrypto_argon2id_hash, crypto_argon2id_verifyBounded 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

  1. Download pawn_crypto.so (Linux) or pawn_crypto.dll (Windows) and crypto.inc from Releases, or build from source.
  2. Copy crypto.inc into your Pawn include directory, such as pawno/include/ or qawno/include/.
  3. Load the binary using one mode:
    • SA-MP: place it in plugins/ and add pawn_crypto.so on Linux or pawn_crypto on Windows to the plugins line in server.cfg.
    • open.mp native: place it in components/; the server loads it automatically.
    • open.mp legacy: place it in plugins/ and add pawn_crypto to pawn.legacy_plugins in config.json.

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.

GuideContents
InstallationBinary placement and server configuration.
SHA-2Data digests and output buffers.
HMACMessage authentication and tag verification.
Argon2idPassword storage, callbacks and resource limits.
API referenceNative signatures, aliases, constants and return values.
ErrorsSubmission failures, callback results and troubleshooting.
SecurityData handling, secrets and application responsibilities.
BuildingToolchain, build scripts and validation commands.
Dependency licensescargo-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

Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью

NullSablex/pawn-crypto: Плагин для SA-MP | samp.directory