Added a new test to ensure that the generator is restored correctly

The new test ensures that the nonce generator is restored to the
previous state correctly and that nonce/IV are not reused.