Fix crypto padding
Fix square bracket array indexing, casts, typo