I feel there is something missing here , the code is meant to be rolling encryption . so something needs to be saved for the next call doesn't it ?