Fix corrupted enc/dec binary output via streams

Close keybase/keybase-issues#463
Close keybase/keybase-issues#187