Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var salt = "FbSnXHPo12gb";
- var password = "geheim";
- var interactions = 12000;
- using (var hmac = new HMACSHA256())
- {
- var df = new Pbkdf2(hmac, password, salt, interactions);
- Console.WriteLine(Convert.ToBase64String(df.GetBytes(32)));
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using MySql.Data.MySqlClient;
- using System.IO;
- using System.Security.Cryptography;
- namespace login
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- private void login_Click(object sender, RoutedEventArgs e)
- {
- var salt = "FbSnXHPo12gb";
- var password = "geheim";
- var interactions = 12000;
- using (var hmac = new HMACSHA256())
- {
- var df = new Pbkdf2(hmac, password, salt, interactions);
- Console.WriteLine(Convert.ToBase64String(df.GetBytes(32)));
- }
- string myConnection = "datasource=localhost;port=3306;username=root;password=abcde12345 ; database=finalproject";
- MySqlConnection myConn = new MySqlConnection(myConnection);
- MySqlCommand SelectCommand = new MySqlCommand("select * from login where Username='" + this.username.Text + "' and Password='" + this.password.Password + "';", myConn);
- MySqlDataReader myReader;
- myConn.Open();
- myReader = SelectCommand.ExecuteReader();
- int count = 0;
- while (myReader.Read())
- {
- count = count + 1;
- }
- if (count == 1)
- {
- MessageBox.Show("Hello");
- }
- else
- {
- MessageBox.Show("Wrong username and password");
- }
- myConn.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement