secure/precis: reduce allocations for non-changing input

Use SpanningTransfomers to avoid allocations if input
doesn’t change.

Next step is to add ASCII fast paths.

Updates golang/go#17423

Change-Id: I8496e77f1e13912b8537a3e98fe0e898cb5bc975
Reviewed-on: https://go-review.googlesource.com/31189
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
5 files changed