Refactor encode/decode into processor
Add stream encryption