stringToKey function

IKey stringToKey(
  1. String s,
  2. KeyType type,
  3. int size,
  4. String suffix,
)

Implementation

IKey stringToKey(String s, KeyType type, int size, String suffix) {
  var whole = base58ToBinary(size + 4, s);
  var result = IKey(type, whole);
  var digest = digestSuffixRipemd160(result.data, suffix);
  if (digest[0] != whole[size + 0] ||
      digest[1] != whole[size + 1] ||
      digest[2] != whole[size + 2] ||
      digest[3] != whole[size + 3]) {
    throw 'checksum doesn\'t match';
  }
  return result;
}