Files
wycheproof/schemas/primality_test_schema.json
bleichen 68482d5d8d Moving test vectors for primality test into a JSON file.
Adding more tests:
- the previous test did not include any primes. Hence arithmetic
  errors in a primality test would likely remain undetected.
- some primes have been generated so that the multiplier for a
  Montgomery reduction is an edge case (e.g. high or low Hamming weight).
- adding negatives of primes. Different libraries disagree, whether such
  integers are prime or not. The corresponding test vectors have a flag
  and result "acceptable".

The following libraries have been tested:

java.math.BigInteger: primality testing is not part of JCA and hence is
    provider independent.
sympy: Old versions of sympy used a weak set of bases and was deterministic.
    This is no longer the case.
NOKEYCHECK=True
PiperOrigin-RevId: 278337837
GitOrigin-RevId: 02debe45343e8da38b21a6e7a56a4a2b1c050bd8
2019-11-25 17:44:27 -08:00

92 lines
2.0 KiB
JSON

{
"type": "object",
"definitions": {
"PrimalityTestGroup": {
"type": "object",
"properties": {
"type": {
"enum": [
"PrimalityTest"
]
},
"tests": {
"type": "array",
"items": {
"$ref": "#/definitions/PrimalityTestVector"
}
}
}
},
"PrimalityTestVector": {
"type": "object",
"properties": {
"tcId": {
"type": "integer",
"description": "Identifier of the test case"
},
"comment": {
"type": "string",
"description": "A brief description of the test case"
},
"value": {
"type": "string",
"format": "BigInt",
"description": "the integer to test"
},
"result": {
"type": "string",
"description": "Test result",
"enum": [
"valid",
"invalid",
"acceptable"
]
},
"flags": {
"type": "array",
"items": {
"type": "string"
},
"description": "A list of flags"
}
}
}
},
"properties": {
"algorithm": {
"type": "string",
"description": "the primitive tested in the test file"
},
"generatorVersion": {
"type": "string",
"description": "the version of the test vectors."
},
"header": {
"type": "array",
"items": {
"type": "string"
},
"description": "additional documentation"
},
"notes": {
"type": "object",
"description": "a description of the labels used in the test vectors"
},
"numberOfTests": {
"type": "integer",
"description": "the number of test vectors in this test"
},
"schema": {
"enum": [
"primality_test_schema.json"
]
},
"testGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/PrimalityTestGroup"
}
}
}
}