Improve the performance of decrypt/encrypt