PrimeTest
PrimeTest
Tests the given integer for being a probable prime.
Syntax
IppStatus ippsPrimeTest(int
nTrials
, Ipp32u *
pResult
, IppsPrimeState*
pCtx
, IppBitSupplier
rndFunc
, void*
pRndParam
);
Include Files
ippcp.h
Parameters
- nTrials
- Security parameter specified for the Miller-Rabin probable primality.
- pResult
- Pointer to the result of the primality test.
- pCtx
- Pointer to theIppsPrimeStatecontext.
- rndFunc
- Specified Random Generator.
- pRndParam
- Pointer to the Random Generator context.
Description
The function uses the Miller-Rabin probabilistic primality test scheme with the given security parameter to test if the given integer is a probable prime. The pseudorandom number used in the Miller-Rabin test is generated by the specified
rndFunc
Random Generator. The function sets up the *pResult
as IS_PRIME
or IS_COMPOSITE
to show if the input probable prime passes the Miller-Rabin test.Return Values
- ippStsNoErr
- Indicates no error. Any other value indicates an error or warning.
- ippStsNullPtrErr
- Indicates an error condition if any of the specified pointers isNULL.
- ippStsContextMatchErr
- Indicates an error condition if the context parameter does not match the operation.
- ippStsBadArgErr
- Indicates an error condition ifnTrialsis less than 1.