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 7783371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:49:09+00:00 2026-06-01T19:49:09+00:00

I have to implement a simple hashing algorithm. Input data: Value (16-bit integer). Key

  • 0

I have to implement a simple hashing algorithm.

Input data:

  • Value (16-bit integer).
  • Key (any length).

Output data:

  • 6-bit hash (number 0-63).

Requirements:

  • It should be practically impossible to predict hash value if you only have the input value but not the key. More specific: if I known hash(x) for x < M, it should be hard to predict hash(M) without knowing the key.

Possible solutions:

  1. Keep full mapping as a key. So the key has length 2^16*6 bits. It’s too long for my case.
  2. Linear code. Key is a generator matrix. It’s length is 16*6. But it’s easy to find generator matrix using several known hash values.

Are there any other possibilities?

  • 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-06-01T19:49:11+00:00Added an answer on June 1, 2026 at 7:49 pm

    A HMAC seems to be what you want. So a possibility for you could be to use a SHA-based HMAC and just use a substring of the resulting hash. This should be relatively safe, since the bits of a cryptographic hash should be as independent and unpredictable as possible.

    Depending on your environment, this could however take too much processing time, so you might have to chose a simpler hashing scheme to construct your HMAC.

    Original Answer the discussion in the comments is based on:

    Since you can forget cryptographic properties anyway (it is trivial to find collisions via bruteforce attacks on a 5-bit hash) you might as well use something like CRC or Hamming Codes and get error-detection for free

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

Sidebar

Related Questions

I have to implement simple ray tracing algorithm, but I can not figure out
I am trying to implement a simple decimation algorithm in c++. I have two
i have this class called MemoryManager, it is supposed to implement a simple smart
In general, is it a best practice to have simple POJO Java classes implement
After reading about salts password hashing Id like to implement a simple version for
I am working on a college project, where I have to implement a simple
In Silverlight with RIA services it is very easy to implement simple data filtering
In My Application i have Implement the Simple Gallery Demo. Here i am going
I have a Django application in which I need to implement a simple trending/ranking
I'm trying to implement a simple search function. I have a string array which

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.