Skip to content

HASH is mismatching for larger size of file #99

Open

Description

@Ashok-d-attikatti

Hello Team,

I have attached the file here that is the HASH generator for the SHA
sha.txt

Could you give me a suggestion for this code?

We are checking the hardware crypto accelerator using the /dev/crypto, and the code is working as expected for the lower file size.
If it is more than the 20/30MB file our system will hang because it cannot handle the large memory at a time. So we made changes in the code as below in the code
sha1.txt
but in this code, we are not able to get the HASH value as we expected.

Can anyone suggest a different way to handle the whole data?

Thanks,
Ashoka A D

Activity

  1. Ashok-d-attikatti commented on Sep 18, 2024

    @Ashok-d-attikatti
    Author

    Hello,

    Any comment on this.?

    Thanks,
    Ashoka A D

  2. cristian-stoica commented on Sep 18, 2024

    @cristian-stoica
    Collaborator

    @Ashok-d-attikatti Have you looked at https://github.com/cryptodev-linux/cryptodev-linux/blob/master/examples/sha-copy.c ?

    It seems to do what you want. In particular you should use COP_FLAG_UPDATE for intermediary chunks and COP_FLAG_FINAL at the end.

  3. Ashok-d-attikatti commented on Sep 18, 2024

    @Ashok-d-attikatti
    Author

    Hello @cristian-stoica ,
    I have used the COP_FLAG_UPDATE and COP_FLAG_FINAL flags while doing work around methods, but did not work as expected.

  4. Ashok-d-attikatti commented on Sep 19, 2024

    @Ashok-d-attikatti
    Author

    Look at this example: https://github.com/cryptodev-linux/cryptodev-linux/blob/master/examples/sha-copy.c. This will not work for a file, and the data size is small as well. If we want a larger file size, would this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions