Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

digest: add FixedOutputDirty trait + finalize_into* #180

Merged
merged 1 commit into from Jun 9, 2020

Commits on Jun 9, 2020

  1. digest: add FixedOutputDirty trait + finalize_into*

    Adds a `FixedOutputDirty` trait which writes the digest output to a
    provided byte array, but does not reset the internal state. This is
    intended for implementations to use in order to ensure that they are
    not reset in the event the instance is consumed.
    
    Also adds a set of `finalize_into` and `finalize_into_reset` methods to
    `FixedOutput` whhich also write their input into a provided byte array,
    and changes the existing `finalize_fixed` (and newly added
    `finalize_fixed_reset`) methods to have a default implementation which
    returns a byte array allocated on the stack.
    
    Finally, adds a blanket impl of `FixedOutput` for `FixedOutputDirty` +
    `Reset` types which handles safely invoking the underlying
    implementation by either consuming the instance (avoiding a reset)
    or borrowing the hasher, obtaining the output, and resetting.
    tarcieri committed Jun 9, 2020
    Copy the full SHA
    2526a6a View commit details
    Browse the repository at this point in the history