Restructure handling of cipher-based generators. Add counter-mode