private void LoginButtonClicked(object sender, RoutedEventArgs e) { string address = AddressComboBox.Text;; string hashPw = Sha.GenerateSha256String(PasswordBox1.Password); //check Private key and public Key var walletBank = new WalletBank(); var wallet = walletBank.FindWallet(address, hashPw); if (wallet == null) { Errormessage.Text = "First import your wallet"; return; } if (!wallet.IsValid()) { Errormessage.Text = "Wallet isn't valid"; return; } //check inside DB var context = new UserContext(); var user = context.Users.FirstOrDefault(n => n.Address == address && n.Password == hashPw); if (user != null) { NavigationService?.Navigate(new WalletPage(user)); } else { Errormessage.Text = "Passwords doesn't match or connection is lost"; } }
public static byte[] PublicKeyHashed(byte[] pubK) { var pubHash = Sha.GenerateSha256String(ByteHelper.GetStringFromBytes(pubK)); var ripemd160 = new RIPEMD160Managed(); var ripemd160Hash = ripemd160.ComputeHash(Encoding.UTF8.GetBytes(pubHash)); return(ripemd160Hash); }