Assertions to prevent us from doing anything we can't support

This commit is contained in:
Sean Bowe 2015-12-05 20:29:28 -07:00
parent bbc60f62dc
commit a891c74dae
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@ sodoku_encryption_key<FieldT>::sodoku_encryption_key(protoboard<FieldT> &pb,
{
assert(seed_key.size() == (256-8));
unsigned int num_key_digests = div_ceil(dimension * dimension * 8, 256);
assert(num_key_digests < 256); // after this it will cycle
padding_var.reset(new digest_variable<FieldT>(pb, 256, "padding"));
@ -163,6 +164,8 @@ sodoku_gadget<FieldT>::sodoku_gadget(protoboard<FieldT> &pb, unsigned int n) :
{
dimension = n * n;
assert(dimension < 256); // any more will overflow the 8 bit storage
const size_t input_size_in_bits = dimension * dimension * 8;
{
const size_t input_size_in_field_elements = div_ceil(input_size_in_bits, FieldT::capacity());