public static bool Verify(string encoded) { if (string.IsNullOrEmpty(encoded.Trim())) { return(false); } if (encoded.Length != ENCODED_SIZE) { return(false); } try { var hash = Address32Format.Decode(encoded, out var type); if (hash == null || hash.Length != RAW_SIZE - 1) { return(false); } if (!Enum.IsDefined(typeof(AddressType), type)) { return(false); } } catch (Exception e) { return(false); } return(true); }
public Address(string encoded) { Debug.Assert(encoded.Length == ENCODED_SIZE); Encoded = encoded; hash = Address32Format.Decode(encoded, out Type); Debug.Assert(hash != null); Debug.Assert(hash.Length == RAW_SIZE - 1); }
public void TestAddress32Format() { // Private 7r7oFxKhhaH7UvMLpUXlcIEk0WWx7i4nw6BVnrKCmLk= var address = "qyl68tygnjx6qqwrsmynmejmc9wxlw7almv3397j"; var hash = Address32Format.Decode(address, out var type); var encoded2 = Address32Format.Encode(type, hash); Assert.IsTrue(address == encoded2); }