Password consists of 6-12 digits or letters, password hash encryption

Source: Internet
Author: User

        Private voidButton1_Click (Objectsender, RoutedEventArgs e) {            stringPwdregex ="^[a-za-z0-9]{6,12}$"; System.Text.RegularExpressions.Regex regpwd=NewSystem.Text.RegularExpressions.Regex (Pwdregex); if(!Regpwd.ismatch (PasswordBox1.Password.Trim ())) {label_warning. Content="Hint: the password is made up of 6-12 digits or letters! "; }            Else if(PasswordBox1.Password.Equals (Passwordbox2.password)) {MD5 MD5=NewSystem.Security.Cryptography.MD5CryptoServiceProvider (); byte[] str =Md5.computehash (System.Text.Encoding.UTF8.GetBytes (Passwordbox1.password)); stringPWD =string.                Empty;  for(inti =0; I < Str. Length; i++) {pwd+ = Convert.ToString (Str[i], -). PadLeft (2,'0'); }                Try                {                    using(Stockmanagedatacontext Smdatacontext =NewStockmanagedatacontext ()) {                        stringUsrname = ( This. Parent asLoginwindow).                        User; vars = smDataContext.Users.Single (c = C.username = =usrname); S.password=pwd;                        Smdatacontext.submitchanges (); MessageBox.Show ("Password added successfully! ");  This. Navigationservice.navigate (NewUri ("Loginpage.xaml", urikind.relative)); }                }                Catch(Exception ex) {MessageBox.Show (ex).                    Message); Label_warning. Content="Hint: password modification failed! "; }            }            Else{label_warning. Content="Hint: the password entered two times is different! "; }        }

Password consists of 6-12 digits or letters, password hash encryption

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.