Calculate SHA3-256 digest of a file prefixed with shared secret

133
August 28, 2021, at 08:30 AM

I am using the following code to compute the message digest of a file -
in points to a file here

        bytesRead = in.read(inputBuffer);
         md= MessageDigest.getInstance("SHA3-256");
    while (bytesRead > 0) {
                md.update(inputBuffer, 0, bytesRead);
                    bytesRead = in.read(inputBuffer);
}

Now my aim is to calculate the digest of a file prefixed with a shared secret = hello world
I am not sure if message digest provides any special methods to include a shared secret
I explored the PBEKEYSpec class but that seems to be having a different purpose for passwords etc.
One option to achieve this could be simply to take the shared secret and put it in front of the file and compute the digest. Will that be a good approach? Any other better approach?

Rent Charter Buses Company
READ ALSO
Handling card overflow text

Handling card overflow text

I have this card container to display some text that is overflowing

46
How can I submit a form from JavaScript?

How can I submit a form from JavaScript?

I have a form with 2 buttons and would like to display a jQuery Dialog when a button is clickedWhen clicking on a button (say 'Yes') which is displayed on the jQuery Dialog, I'd like to execute a Drupal handler

101