Cast unsigned types for all cipher functions
Refactor manual casting to type in cipher struct to remove casting duplication.