and throws if finish is called twice. This has been copied from gleam_crypto, which has the same issue.