- Documentation
- Reference manual
- Packages
- SWI-Prolog SSL Interface
- library(crypto): Cryptography and authentication library

- SWI-Prolog SSL Interface

ss="defbody">
If the tag length is smaller than 16, this option must be used to permit
such shorter tags. This is used as a safeguard against truncation
attacks, where an attacker provides a short tag that is easier to guess.

### 3.9 Number theory

This library provides operations from number theory that frequently arise in cryptographic applications, complementing the existing built-ins and GMP bindings:

- [det]
**crypto_modular_inverse**(`+X, +M, -Y`) - Compute the modular multiplicative inverse of the integer
`X`.`Y`is unified with an integer such that`X`*`Y`is congruent to 1 modulo`M`. - [det]
**crypto_generate_prime**(`+N, -P, +Options`) - Generate a prime
`P`with at least`N`bits.`Options`is a list of options. Currently, the only supported option is:**safe**(`Boolean`)- If
`Boolean`is`true`

(default is`false`

), then a*safe*prime is generated. This means that`P`is of the form 2*Q + 1 where Q is also prime.

- [semidet]
**crypto_is_prime**(`+P, +Options`) - True iff
`P`passes a probabilistic primality test.`Options`is a list of options. Currently, the only supported option is:**iterations**(`N`)