"ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d1"+
"7d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923")
+ @requires_blake2
+ def test_case_blake2b_all_parameters(self):
+ # This checks that all the parameters work in general, and also that
+ # parameter byte order doesn't get confused on big endian platforms.
+ self.check('blake2b', b"foo",
+ "920568b0c5873b2f0ab67bedb6cf1b2b",
+ digest_size=16,
+ key=b"bar",
+ salt=b"baz",
+ person=b"bing",
+ fanout=2,
+ depth=3,
+ leaf_size=4,
+ node_offset=5,
+ node_depth=6,
+ inner_size=7,
+ last_node=True)
+
@requires_blake2
def test_blake2b_vectors(self):
for msg, key, md in read_vectors('blake2b'):
self.check('blake2s', b"abc",
"508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982")
+ @requires_blake2
+ def test_case_blake2s_all_parameters(self):
+ # This checks that all the parameters work in general, and also that
+ # parameter byte order doesn't get confused on big endian platforms.
+ self.check('blake2s', b"foo",
+ "bf2a8f7fe3c555012a6f8046e646bc75",
+ digest_size=16,
+ key=b"bar",
+ salt=b"baz",
+ person=b"bing",
+ fanout=2,
+ depth=3,
+ leaf_size=4,
+ node_offset=5,
+ node_depth=6,
+ inner_size=7,
+ last_node=True)
+
@requires_blake2
def test_blake2s_vectors(self):
for msg, key, md in read_vectors('blake2s'):
goto error;
}
}
- self->param.leaf_length = (unsigned int)leaf_size;
+ // NB: Simple assignment here would be incorrect on big endian platforms.
+ store32(&(self->param.leaf_length), leaf_size);
if (node_offset_obj != NULL) {
node_offset = PyLong_AsUnsignedLongLong(node_offset_obj);
}
store48(&(self->param.node_offset), node_offset);
#else
- self->param.node_offset = node_offset;
+ // NB: Simple assignment here would be incorrect on big endian platforms.
+ store64(&(self->param.node_offset), node_offset);
#endif
if (node_depth < 0 || node_depth > 255) {
goto error;
}
}
- self->param.leaf_length = (unsigned int)leaf_size;
+ // NB: Simple assignment here would be incorrect on big endian platforms.
+ store32(&(self->param.leaf_length), leaf_size);
if (node_offset_obj != NULL) {
node_offset = PyLong_AsUnsignedLongLong(node_offset_obj);
}
store48(&(self->param.node_offset), node_offset);
#else
- self->param.node_offset = node_offset;
+ // NB: Simple assignment here would be incorrect on big endian platforms.
+ store64(&(self->param.node_offset), node_offset);
#endif
if (node_depth < 0 || node_depth > 255) {