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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:13:15+00:00 2026-05-30T16:13:15+00:00

I’m trying to figure out how to store a hash in my Access Database.

  • 0

I’m trying to figure out how to store a hash in my Access Database. Now I have generated a hash by salting a user password with the User ID (not highly secure I know, but plenty for my purposes). I have also stored the hashed values in the database as Base64 strings (manually, I haven’t yet developed the module to do that automatically), however, when I go to retrieve the hash from the database I receive the hex code in place of the string. I know that the string is stored in the database since I stored it there manually so I’m not quite sure what’s going on.

This is the code for the login button:

Sub prcLogin()
        'Log User in

        Dim ds As New DataSet
        Dim blnCorrect As Boolean

        'Fill DataSet with login details
        prcConnectSet("SELECT * FROM Parent", "User", ds)

        strUser = txtUser.Text

        'Ensure username field is not blank
        If strUser <> "" Then

            'Search for the user
            For Each Row In ds.Tables("User").Rows
                Dim HashedPass As String = fncComputeHash(txtPass.Text & strUser)
                Dim ContainedPass As String = Row.Item(3)
                'Validate user
                If strUser = Row.Item(0) Then
                    If HashedPass = Row.Item(3) Then
                        blnCorrect = True
                        lblLoggedAs.Text = Row.Item(1)
                        Exit For
                    End If
                Else
                    blnCorrect = False
                End If
            Next
        End If

And this is the code for the hash calculator:

    Function fncComputeHash(ByVal PasswordField As String) As String
        Dim Hasher As New SHA256CryptoServiceProvider()
        Dim encoder As New UTF8Encoding()

        Return Convert.ToBase64String(Hasher.ComputeHash(encoder.GetBytes(PasswordField)))

    End Function

But when I run this instead of returning a value like “rlzhYoiO4+vpdJdsrFq5Sj9VBJ+FFYhIg9V5+z+jeNI=” which I stored in the database, it returns a value like “5C6BED0D94B9BE8AFBC5C8CAC1E9D4BE03F556917C2611EC56F4E6F341EF60D9”. Now how do I get around this? Am I storing the values incorrectly? Should I store them as a byte array? If so, how do I do that? Or am I retrieving the values incorrectly? Or are those ok and should I be converting the value once I get it back from the database?

I’m very new to this whole encryption lark and even authentication so if I’m doing something stupid do tell me.

Thanks in advance!

Edit: I’m using the “Text” data type in Access.

Edit 2: Sorry I understand the confusion now. I’m storing only the hash! Not the plaintext password. So it’s vital the hash received from the database is in the same format as that from the user id and password.

Edit 3: OK Thanks guys, I’ve solved it. I needed to convert it to a hex string using the SoapHexBinary function.

  • 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-30T16:13:17+00:00Added an answer on May 30, 2026 at 4:13 pm

    I found what I needed. The “SoapHexBinary” function is what I need. Here is an example:

    Function fncComputeHash(ByVal PasswordField As String) As String
        'Compute SHA-256 Hash value
    
        Dim Hasher As New SHA256CryptoServiceProvider()
        Dim encoder As New UTF8Encoding()
        Dim shb As New SoapHexBinary(Hasher.ComputeHash(encoder.GetBytes(PasswordField)))
    
        Return shb.ToString
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.