Results 1 to 5 of 5

Thread: How to reserved this code ? Pls

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2024
    Posts
    2

    How to reserved this code ? Pls

    I have code like this :
    HTML Code:
    Public Function Hash(ByVal fileName As String) As UInt64
            Dim id As UInt64 = 0
            Dim index As Integer = 0
            For Each c As Char In fileName
                If (AscW(c) >= AscW("A")) AndAlso (AscW(c) <= AscW("Z")) Then
                    id = (id + (++index) * (AscW(c) + AscW("a") - AscW("A"))) Mod &H8000000BUI * &HFFFFFFEF
                Else
                    id = (id + (++index) * AscW(c)) Mod &H8000000BUI * &HFFFFFFEF
                End If
            Next
            Return (id Xor &H12345678)
        End Function

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,515

    Re: How to reserved this code ? Pls

    Are you asking how to reverse this Hash process? Like an "UnHash" that will return the original String? If not then you need to be much clearer on what specifically you are looking for help with.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2024
    Posts
    2

    Re: How to reserved this code ? Pls

    Quote Originally Posted by OptionBase1 View Post
    Are you asking how to reverse this Hash process? Like an "UnHash" that will return the original String? If not then you need to be much clearer on what specifically you are looking for help with.
    Yes, i need unhash return the original string

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,496

    Re: How to reserved this code ? Pls

    That’s not possible

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: How to reserved this code ? Pls

    Hashing is specifically a one-way process. That's one of the main points of hashing, e.g. it allows you to compare a password at login to a password at registration based on their hashes but never let's you get the registration password back from the stored hash. If you want a two-way process then you want encryption rather than hashing. Note that hashes are also usually fairly short, so they allow you to do things like confirm that a large file download with error by hashing what you got and comparing it with the hash of the original. Encrypted data may be much longer because it needs to store a representation of all the original data. Hashes are such that multiple original values can produce the same hash, whereas that should never be the case for encrypted data.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width