Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7541121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:48:42+00:00 2026-05-30T07:48:42+00:00

I am currently working on a Log in form but the thing here is

  • 0

I am currently working on a Log in form but the thing here is that when I enter an invalid username this errors comes up.

Invalid length for a Base-64 char array.

On this line of code:

bool isSame = hasher.CompareStringToHash(txtPassword.Text, hashedPassword);

Here is the full code

public void verifyAccount()
        {
            var hashedPassword = getPassword();

            var hasher = new Hasher();

            hasher.SaltSize = 16;
            bool isSame = hasher.CompareStringToHash(txtPassword.Text, hashedPassword);

            if (isSame==false)
            {
                MessageBox.Show("Invalid UserName or Password");
            }
            else
            {
                MainWindow main = new MainWindow();
                this.Hide();
                main.ShowDialog();
                this.Close();
            }   
        }

And the This is the method for searching a such username at the same time getting their password password in the database.

public string getPassword()
        {

            DataClasses1DataContext myDbContext = new DataClasses1DataContext(dbPath);


            var password = (from user in myDbContext.Accounts
                           where user.accnt_User == txtUser.Text
                           select user.accnt_Pass).FirstOrDefault();

             if (password == null) {
                 return "z"; 
             }

            return password;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:48:44+00:00Added an answer on May 30, 2026 at 7:48 am

    Base64 data should be 4-bytes aligned. So for example the “z” that you’re returning should be Base64 encoded and padded like this: “eg==” to be Base64 compliant. You should do the same type of padding for the real hashed password.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a log in form and I've heard the best
Here is my scenario. I have a working login form that functions correctly. I
I am currently working on an iPhone app that will have a user log
I'm working on an application that currently has two activites, a log in activity
Am currently working on an application that requires users to submit posts and comments
Im currently working on a site that you can upload large files.. on local
I'm working on a PHP contact form, but I can't get it to work.
I've tried to various solutions to this problem, but nothing seems to be working.
I am currently working on a program, that can handle Minecraft servers. I am
I am currently working on a call log project. The boss wants me to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.