HashFunction.fromName constructor
- String name
Get a HashFunction from its name name
according to either
- IANA's hash name register (http://www.iana.org/assignments/hash-function-text-names/hash-function-text-names.xhtml)
- XEP-0300
Implementation
factory HashFunction.fromName(String name) {
switch (name) {
case _hashSha1:
return HashFunction.sha1;
case _hashSha256:
return HashFunction.sha256;
case _hashSha512:
return HashFunction.sha512;
case _hashSha3256:
return HashFunction.sha3_256;
case _hashSha3512:
return HashFunction.sha3_512;
case _hashBlake2b256:
return HashFunction.blake2b256;
case _hashBlake2b512:
return HashFunction.blake2b512;
}
throw Exception('Invalid hash function $name');
}