Moved crypto functions to helper class