added a naive checking for IV reuse; added catchable exceptions for invalid tags/inputs; fixed a typo