Refactored existing code and added support for symmetric encryption.

I meant replacing the last four lines of the function with `return nonceSliceToArray(bytes)`, since they're doing the same thing. Not a big deal either way, though.