add padding sequence calculation and validation