Skip to content

Reuse of createHash initializations #25857

Closed
@ppKrauss

Description

@ppKrauss

Reuse is a fundamental issue...

const crypto = require('crypto')
const H = crypto.createHash('md5')  // NEED REUSE THIS INITIALIZATION
console.log( H.update('some data to hash').digest('hex') ) // first ok...
console.log( H.update('some2').digest('hex') )  // ugly "Error: Digest already called"!

The problem that I am trying to solve: to reuse initialization.

The desired behavior: no error.

... No alternative solutions, but please, show me if there are some elegant one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.duplicateIssues and PRs that are duplicates of other issues or PRs.feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions