Skip to content

Android - Hash method still suffers from fix done for other on PR #395 #418

@castro13

Description

@castro13

While trying to use the 'hash' method on Android, I was getting the same error that the PR #395 fixed.
I did a local fix to have ti working.

Is there any possibility of fixing the hash method?
Below is my fix.

  if (!algorithms.containsKey(algorithm)) throw new Exception("Invalid hash algorithm");

  // File file = new File(filepath);

  // if (file.isDirectory()) {
  //   rejectFileIsDirectory(promise);
  //   return;
  // }

  // if (!file.exists()) {
  //   rejectFileNotFound(promise, filepath);
  //   return;
  // }

  MessageDigest md = MessageDigest.getInstance(algorithms.get(algorithm));

  // FileInputStream inputStream = new FileInputStream(filepath);
  // byte[] buffer = new byte[(int) file.length()];

  InputStream inputStream = getInputStream(filepath);
  byte[] buffer = new byte[1024];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions