public void ValidateValidChecksum()
 {
     foreach (string test in VALID_CHECKSUM)
     {
         Bech32Encoder bech  = Bech32Encoder.ExtractEncoderFromString(test);
         int           pos   = test.LastIndexOf('1');
         string        test2 = test.Substring(0, pos + 1) + ((test[pos + 1]) ^ 1) + test.Substring(pos + 2);
         Assert.Throws <FormatException>(() => bech.DecodeData(test2));
     }
 }
Beispiel #2
0
        private ECKeyPair GetPublicKey(SrvRecord srv)
        {
            string bech32 = srv.Target.Value.Split('.').First();

            Bech32Encoder bech32Encoder   = Encoders.Bech32("ln");
            var           bech32Data5Bits = bech32Encoder.DecodeData(bech32);
            var           bech32Data8Bits = ConvertBits(bech32Data5Bits, 5, 8, false);

            return(new ECKeyPair(bech32Data8Bits, false));
        }