View Source Altcha (Altcha v0.1.0)
Altcha module provides functions for creating and verifying ALTCHA challenges.
Summary
Functions
Converts an algorithm name from binary format to an atom.
Converts an algorithm atom to its binary representation.
Creates a challenge with the specified options.
Extracts parameters from the payload's salt.
Hashes data using the specified algorithm.
Hashes data using the specified algorithm and returns it as a hex string.
Computes HMAC for the given data using the specified algorithm and key.
Creates an HMAC from the data using the specified algorithm and key, and returns it as a hex string.
Generates a specified number of random bytes.
Generates a random integer between 0 and the given maximum value.
Solves a challenge by searching for a number that matches the given challenge.
Verifies if the hash of form fields matches the provided hash.
Verifies the server signature using the payload and HMAC key.
Verifies a solution by checking its validity and comparing it with the expected challenge.
Functions
Converts an algorithm name from binary format to an atom.
Converts an algorithm atom to its binary representation.
Creates a challenge with the specified options.
Extracts parameters from the payload's salt.
Hashes data using the specified algorithm.
Hashes data using the specified algorithm and returns it as a hex string.
Computes HMAC for the given data using the specified algorithm and key.
Creates an HMAC from the data using the specified algorithm and key, and returns it as a hex string.
Generates a specified number of random bytes.
Generates a random integer between 0 and the given maximum value.
solve_challenge(challenge, salt, algorithm \\ :sha256, max \\ 1_000_000, start \\ 0)
View SourceSolves a challenge by searching for a number that matches the given challenge.
Verifies if the hash of form fields matches the provided hash.
Verifies the server signature using the payload and HMAC key.
Verifies a solution by checking its validity and comparing it with the expected challenge.