hashAlgoToID function

int hashAlgoToID(
  1. String hashAlgo
)

Get the ID of a given hash algorithm @params {String} hashAlgo Hash algorithm

Implementation

int hashAlgoToID(String hashAlgo) {
  switch (hashAlgo) {
    case 'sha256':
      return 0;
    case 'sha512':
      return 1;
    case 'sha3-256':
      return 2;
    case 'sha3-512':
      return 3;
    case 'blake2b':
      return 4;
    default:
      throw 'Hash algorithm not supported';
  }
}