Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
primes.hpp
Go to the documentation of this file.
1#pragma once
2
3// Prime number utilities — generation and primality testing via Mbed TLS.
4// Used for RSA key generation.
5
6#include <cstdint>
7#include <vector>
8
9namespace pulp::runtime {
10
13bool is_prime(uint64_t n, int rounds = 40);
14
17uint64_t generate_prime(int bits = 32);
18
20std::vector<uint32_t> sieve_primes(uint32_t limit);
21
22} // namespace pulp::runtime
Definition generated_event_source.hpp:33
std::vector< uint32_t > sieve_primes(uint32_t limit)
Generate the first N primes via sieve of Eratosthenes.
uint64_t generate_prime(int bits=32)
Generate a random prime of the given bit length.
bool is_prime(uint64_t n, int rounds=40)
Test if a number is probably prime (Miller-Rabin).