# hashFromData static method

Future <List <int>> hashFromData(

1. HashFunction function,
2. List <int> data

)

Compute the raw hash value of `data` using the algorithm specified by `function`. If the function is not supported, an exception will be thrown.

## Implementation

    static Future<List<int>> hashFromData(
      HashFunction function,
      List<int> data,
    ) async {
      // TODO(PapaTutuWawa): Implement the others as well
      HashAlgorithm algo;
      switch (function) {
        case HashFunction.sha1:
          algo = Sha1();
          break;
        case HashFunction.sha256:
          algo = Sha256();
          break;
        case HashFunction.sha512:
          algo = Sha512();
          break;
        case HashFunction.blake2b512:
          algo = Blake2b();
          break;
        // ignore: no_default_cases
        default:
          throw Exception();
      }

      final digest = await algo.hash(data);
      return digest.bytes;
    }