Skip to main content

Module crypto

Module crypto 

Source
Expand description

Runtime cryptography helpers built on Solana syscalls and precompiles.

Structs§

ProcessedInstruction
ProcessedInstructionAccount
Native account-meta ABI used by caller-buffer sibling introspection. Account metadata returned by the sibling-instruction syscall.
ProcessedInstructionData
ProcessedInstructionView
Processed sibling with runtime address and borrowed scratch prefixes.

Constants§

ALT_BN128_FIELD_SIZE
ALT_BN128_G1_ADDITION_INPUT_SIZE
ALT_BN128_G1_ADD_BE
ALT_BN128_G1_ADD_LE
ALT_BN128_G1_COMPRESS_BE
ALT_BN128_G1_COMPRESS_LE
ALT_BN128_G1_DECOMPRESS_BE
ALT_BN128_G1_DECOMPRESS_LE
ALT_BN128_G1_MULTIPLICATION_INPUT_SIZE
ALT_BN128_G1_MUL_BE
ALT_BN128_G1_MUL_LE
ALT_BN128_G1_POINT_SIZE
ALT_BN128_G1_SUB_BE
ALT_BN128_G1_SUB_LE
ALT_BN128_G2_ADDITION_INPUT_SIZE
ALT_BN128_G2_ADD_BE
ALT_BN128_G2_ADD_LE
ALT_BN128_G2_COMPRESS_BE
ALT_BN128_G2_COMPRESS_LE
ALT_BN128_G2_DECOMPRESS_BE
ALT_BN128_G2_DECOMPRESS_LE
ALT_BN128_G2_MULTIPLICATION_INPUT_SIZE
ALT_BN128_G2_MUL_BE
ALT_BN128_G2_MUL_LE
ALT_BN128_G2_POINT_SIZE
ALT_BN128_G2_SUB_BE
ALT_BN128_G2_SUB_LE
ALT_BN128_LE_FLAG
ALT_BN128_PAIRING_BE
ALT_BN128_PAIRING_ELEMENT_SIZE
ALT_BN128_PAIRING_LE
CURVE25519_EDWARDS
CURVE25519_RISTRETTO
CURVE_GROUP_ADD
CURVE_GROUP_MUL
CURVE_GROUP_SUB
ED25519_PROGRAM_ID
MAX_HASH_SEGMENTS
MAX_INSTRUCTION_ACCOUNTS_BYTES
MAX_INSTRUCTION_DATA_LEN
MAX_POSEIDON_INPUTS
POSEIDON_BIG_ENDIAN
POSEIDON_BN254_X5
POSEIDON_INPUT_LEN
POSEIDON_LITTLE_ENDIAN
SECP256K1_PROGRAM_ID
SECP256R1_PROGRAM_ID
Secp256r1 (P-256) signature-verification precompile (SIMD-0075). This is the precompile passkey / WebAuthn flows verify against.

Functions§

blake3
blake3_single
curve25519_edwards_validate_point
curve_validate_point
get_processed_instruction
Read up to 1,232 bytes and 64 account metas. None means missing or too large. Use get_processed_instruction_into to distinguish these cases.
get_processed_instruction_data
Read bounded instruction data from a sibling with up to 64 account metas. The entire data must fit MAX_DATA; this never returns truncated data. Account scratch is still required by the syscall even when the caller only wants data. Use get_processed_instruction_into to select both capacities.
get_processed_instruction_into
Read a sibling into caller-provided buffers, preserving exact runtime sizes. See hopper_native::introspect::get_processed_instruction_into for scope, capacity errors and host behavior. Account records use native address values; convert an individual address with Address::from(record.address.clone()).
get_stack_height
is_cpi
is_top_level
keccak256
keccak256_single
recover_ethereum_address
require_ed25519_instruction
Checks only the sibling’s program ID. The caller must validate the signature count, offsets, referenced instruction bytes and expected key/message.
require_ed25519_instruction_data
Bounded variant of require_ed25519_instruction, with the same payload checks required of the caller.
require_secp256k1_instruction
Checks only the sibling’s program ID, not signature payload or authorization.
require_secp256r1_instruction
Require that a sibling instruction targeted the Secp256r1 (P-256) precompile. Checks only the program ID. The caller validates signature count, offsets, expected key/message, and any WebAuthn challenge and relying-party policy.
require_secp256r1_instruction_data
Variant of require_secp256r1_instruction returning the bounded instruction-data form for callers that parse the precompile payload.
require_top_level
secp256k1_recover
sha256
sha256_single

Type Aliases§

AltBn128G1
AltBn128G2
AltBn128G1Compressed
AltBn128G2Compressed
AltBn128PairingResult
Blake3Hash
CurvePoint
CurveScalar
EthereumAddress
Keccak256Hash
PoseidonHash
Secp256k1Pubkey
Sha256Hash