Download the PHP package altcha-org/altcha without Composer
On this page you can find all versions of the php package altcha-org/altcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package altcha
ALTCHA PHP Library
The ALTCHA PHP Library is a lightweight, zero-dependency library designed for creating and verifying ALTCHA challenges, specifically tailored for PHP applications.
Compatibility
This library is compatible with:
- PHP 8.2+ (use version v0.x.x for older PHP version)
- All major platforms (Linux, Windows, macOS)
Example
Installation
To install the ALTCHA PHP Library, use the following command:
Usage
Here’s a basic example of how to use the ALTCHA PHP Library:
API
Altcha::createChallenge(ChallengeOptions $options): Challenge
Creates a new challenge for ALTCHA.
Returns: Challenge
ChallengeOptions
Altcha::verifySolution(array|string $payload, bool $checkExpires): bool
Verifies an ALTCHA solution.
Parameters:
data array|string
: The solution payload to verify.checkExpires bool
: Whether to check if the challenge has expired.
Returns: bool
Altcha::verifyFieldsHash(array $formData, array $fields, string $fieldsHash, Algorithm $algorithm): bool
Verifies the hash of form fields.
Parameters:
formData array
: The form data to hash.fields array
: The fields to include in the hash.fieldsHash string
: The expected hash value.algorithm string
: Hashing algorithm (SHA-1
,SHA-256
,SHA-512
).
Returns: bool
Altcha::verifyServerSignature(array|string $payload): ServerSignatureVerification
Verifies the server signature.
Parameters:
data array|string
: The payload to verify (string orServerSignaturePayload
array).
Returns: ServerSignatureVerification
Altcha::solveChallenge(string $challenge, string $salt, Algorithm $algorithm, int $max, int $start = 0): array
Finds a solution to the given challenge.
Parameters:
challenge string
: The challenge hash.salt string
: The challenge salt.algorithm string
: Hashing algorithm (SHA-1
,SHA-256
,SHA-512
).max int
: Maximum number to iterate to.start int
: Starting number.
Returns: null|Solution
Tests
License
MIT
All versions of altcha with dependencies
ext-json Version *