generate iv (wrong formula, rework)