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

  • Home
  • SEARCH
  • 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 4029612
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:22:03+00:00 2026-05-20T11:22:03+00:00

I should write an app that takes string input and computes the hash value

  • 0

I should write an app that takes string input and computes the hash value for the string (the maximun characters of the input is 16), the output should be in length of 22 characters (or less but not more) on base64 format.

I see that .NET framework suggests many hash functions, and I have no idea what to use,
can anyone please recommend me what is the best function to use, and how can I limit the output to 22 characters?

Thanks

  • 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-20T11:22:03+00:00Added an answer on May 20, 2026 at 11:22 am

    You can use MD5 which gives a 128 bit output and then throw away the last two characters when converted to base64, as they’ll always be “==” (padding). This should give you 22 characters.

    string GetEncodedHash(string password, string salt)
    {
       MD5 md5 = new MD5CryptoServiceProvider();
       byte [] digest = md5.ComputeHash(Encoding.UTF8.GetBytes(password + salt);
       string base64digest = Convert.ToBase64String(digest, 0, digest.Length);
       return base64digest.Substring(0, base64digest.Length-2);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Hash Function .NET hi, I should write an app that take string
I'm trying to write a simple app that should mute my mobile phone for
In Model-View-Presenter pattern where should we write validations of user input.
I want to write a small program that should print something like testing CPU...
I'm planning to write an iPhone app that does not require user to register.
I have a web app that takes in variables from the client and generates
I have to write a C app that will act as both UDP sender
Question: Should I write my application to directly access a database Image Repository or
I am wondering should I write unit test for everything. There are some classes
Should log classes open/close a log file stream on each write to the log

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.