Space-efficient AES256/AES128 implementation