Tracker
 ASP PHP JavaScripts MySQL MS Access MSSQL Subjects/Titles Post Text/Content
HOME    TRACKER    Visual Basic

# Hash Table / Hashing Algorithm

## Does anybody have a link to a good tutorial/article on thesubject of Hashing Algorithms?

Hashing Algorithm
Does anybody have the code for a fairly simple hashing algorithm?
I am currently looking a sha1 and well I might not be able to figue it out because I'm not fluent with hex in coding (ushaly use binary instead)
And the author did not comment his code (argh)

Hashing Algorithm!
I want to make a hashing algorithm! Yet beyond a simple definition of what it is " An algorithm that turns a variable-sized amount of text into a fixed-sized output” I have no clue how to create one.

Where do I find information on how to make one? Does anyone have one done in an application that I can view?

Thanks,
Kmax

Hash Algorithm
Just a quick question really,
Anyone know where I can find a hash algorithm which I can use in VB? I'm using an external DLL (not the most secure way, I know) for encryption and decryption, but I'd like to add a hash mechanism.

Any help is appreciated

Hash Algorithm
I wouldl like to incorporate the hash algorithm into my program to encrytion some data and send. Any of you have any idea where to get the lib or dll and how to make it work?

What Is A Hash Table?
Hi,
I am wondering what a hash table is. Is it similar to a database but in memory?? can anyone explain this?
thanks

Hash Table
Does anyone know how do I implement a sort of "Hash Table" in VBA?

Hash Table
hello
I'm interested in the hash tables in eVB. Could you tell me how to implement hash tables using eVB.
narej

Hash Table
Is there any built in Hash table in VB 6?
a key = string data = float hash table
??

FatMan

Definition Of A Hash Table
I was recently reading a book on MMP programming and ran across the term 'Hash Table'. What does it mean, and how would I make one?

Hash Table Class
I am trying to implement this CODE into my current application. But I am having a problem with this section:

VB Code:
Property Get Keys() As Variant()    Dim i As Long, ndx As Long    Dim n As Long    ReDim res(0 To m_Count - 1) As Variant        For i = 0 To m_HashSize - 1        ' take the pointer from the hash table        ndx = hashTbl(i)        ' walk the slottable() array        Do While ndx            res(n) = slotTable(ndx).Key            n = n + 1            ndx = slotTable(ndx).nextItem        Loop    Next            ' assign to the result    Keys = res() '<=== Error can't assign to arrayEnd Property

Any ideas?

Hash Table Object
I'm implementing a hash table in my program. Where can I find the hash table object in vb?

Reverse Eng'g A Hash Table
Anyone know how to go about this? We need to update the information system but the client didn't give the hash function

Hash Table Implementation
Hi all,
Can any one suggest us how to implement a hash table using VB6.0?...
If possible sample code will help us to understand more.

Thanks and Regards,
Bala

Hash Table For Visual Basic?
Is there anything in VB that is similar to the hash table in Java? I have about 10,000 key and value pairs. They're stored in a text file. How can retrieve the value of a particlar key quickly without first converting them into a database?

Thanks!

How Do I Insert An Exclusion List In A Hash Table Routine
How do I insert an exclusion list (a list of words that are to be excluded from the results) in the following code.

Public Function Analyze(ByVal strFileName As String) As SortedList
Dim loFileInfo As FileInfo
Dim laList As New ArrayList()
Dim loSorted As New SortedList()

Dim lsText As String

loFileInfo = New FileInfo(strFileName)

Do
If Not (lsText Is Nothing) Then
End If
Loop Until (lsText Is Nothing)

' laList is an ArrayList containing all the lines of text.
' Loop through all the text, parsing each line.
Dim lsaWords() As String
Dim lsWord As String
Dim loDelimiter() As Char
Dim lsDelimiter As String

' Build up word delimiters.
lsDelimiter = " :;.,-=+{}[]()//?<>_""" & ControlChars.Tab
loDelimiter = lsDelimiter.ToCharArray()
llRow = 0

For i As Integer = 0 To UBofLoop

For Each lsText In laList
' For each line, parse out all the words.
lsaWords = lsText.Split(loDelimiter)
Dim loHashTable As HashTableItem

For Each lsWord In lsaWords

If Len(Trim(lsWord)) > 0 Then
' Is the word already in the table?
If loSorted.ContainsKey(lsWord) Then
' Word already exists. Retrieve existing entry, and increment the usage count.
loHashTable = CType(loSorted.Item(lsWord), HashTableItem)
loHashTable.Count += 1
loSorted.Item(lsWord) = loHashTable
Else
' Word doesn't exist. Create a new item, set the word and count, then add to the table.
loHashTable = New HashTableItem()
loHashTable.Text = lsWord
loHashTable.Count = 1
End If
End If
Next
llRow += 1
Next

Return loSorted
End Function

What Is Hashing Or Hashing Function?
hi all,
lately, i heard ppl talking about this 'hashing function', 'hashing check' what in the world does that totally means? i got really no idea in that. pls someone, give me a clear explanation on this. thks

longwar

Table Algorithm Required... Complex Spec...
I have a database table that contains a list of categories. The table schema is:

catID
catText
superCatID

Where catID is an AutoNumber field, and superCatID points to the parent of a category (this may be null, for a top level category)

And a possible table might be:

Code:
catID catText superCatID
1 A
2 B
3 C
4 AA 1
5 AB 1
6 BA 2
7 BB 2
8 ABA 5
9 CA 3
10 ABAA 8

I want a function that will parse this table, or whatever, and build a structured list of the categories, to fill a combo. This is to simplify a UI, so that catIDs don't have to be remembered.

e.g, the above table should come out looking something like:

Code:
A
-AA
-AB
--ABA
---ABAA
B
-BA
-BB
C
-CA

Now, who wants to be the genius that solves this one?

Getting Data As Hash Table In Winsock Data Arrival
Hello Gurus,

I need a great help from u all Ppls.

The task is, a Server application(Developed in Java) is running in a system. Which would send data to its all client.

Now my problem is I am connecting the Server from my vb program using Winsock Control. No problem, My application is getting coneected. The problem here now is the Java Server Application is sending the data as Hash Table.

I am getting some data in DataArrival event when I try to get the data as follows

Winsock1.GetData str_data, vbString
Debug.print str_data

But here I am getting the raw data I think which is as follows

¬í yyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyy

How could I get those Hash Table's data in my Winsock DataArrival event.

Pls Help me gurus

V.P. Vijayavel

MD4 Hashing
Hi, does anybody know how to get MD4 hashes from files?

I can find class modules for creating MD5 hashes, but I can't find anything for MD4. There is code on pscode.com that should have MD4 in it, but I don't see any MD4 code in there.

http://www.pscode.com/vb/scripts/Sho...50290&lngWId=1

Thank you.

Hashing
Is it posible to hash a string in VB?

(I just need to hash, there is no need to de-crypt)

MD4 Hashing
Hello, does anybody know how to get MD4 hashes from files?

I found a class module for MD5 hashing in this thread: http://www.vbforums.com/showthread.php?t=345542

Is there a MD4 version available? I wasn't able to find anything with google. Thank you.

NT, Hashing..
Does anyone know how Windows NT takes the password, and throws it through a one way encryption scheme. Does anyone have that code. L0pht Heavy Industies found a way, So I believe the code is not only in Microsofts's Sealed whatever. Any help is appreciated. EISECURE please don't resopnd unless you have the final answer you seem to lock my threads.

Really Simple Hashing.
I'm working on a little database program (for use over a lan/locally), and I need a way to encode a unique identifier into my database files, to determine whether an arbitrary client machine was the creator or not. I already figured out how to get a machine name (GetComputerName), but what I'm trying to figure out now is how to fit these identifiers into a fixed-length format that is as small as possible.

Because it will only be used on ten or fifteen machines tops (out of about 150), my suggested implementation would be to get the machine name, then feed it into a hashcode generator to form a four byte long value that should have a minimal chance of collisions. This is just for general, non-critical "did I make this, or did somebody else?" author checking. I don't need 256-bit AES block ciphers or anything like that, just a simple little function that takes a string and consistently generates a 32-bit value from it (prefferably long, but a 4-byte string will work too).

I tried looking around on wikipedia, but they only cover wide-use crytography-related algorithms, and as we all know vb doesn't handle pointers very well.

Once I get it up and running, I can have one client update a common database over a network, and have any other clients viewing the file automatically refresh when a change is made. I'm sure there's probably some existing system, but this app is relatively simple, coded-from-scratch, and single purpose; because of the complex UDT's it stores, it's more efficient as it is than a general purpose database manager would be (think binary access, version tracking, and custom date-as-long functions).

Any help would be greatly appreciated in this matter.

Cheers.

Md5 Or Sha-1 Hashing Functions In VB6?
Does VB6 have built in functions for hashing using md5 or sha-1?

Data Hashing
Does anyone know if it is posible to generate an md5 hash of a file like you can in PHP, but in VB? (I need it to be the same as md5, close to it)

I know (and have read) the data encryption tutorial in the knoledge base, but was hoping (for simplicity) that I could just md5 a file.

(I need to hash the file to see if it maches a hash that I have on record. This is to be able to detect tampering with the file)

Hashing A String?
Hello! How do I hash a string, as in when the user types it appears hashed. I do not actually want to encrpyt the string but just pass it as a string. The hashing is just to stop people looking over the users shoulder from seeing the password! Any ideas?
GG

My Hashing Is Insecure!
all,
Ive created a hashing algorithm, but it has a major flaw, and that is that you can work out a pattern, and therefore crack the hash.

Code:
Option Explicit
'Subroutines used by program go here!
Public Function Hash(strPlain As String) As String
Dim i, intAsc As Integer
Dim strHash As String
For i = 1 To Len(strPlain)
intAsc = Asc(Mid(strPlain, i, 1))
strHash = strHash & (intAsc Xor i)
Next i
Hash = strHash
End Function

Can anyone help me with eliminating or reducing this possibility? Would a checksum work??

thanks,
alt_255

Hashing Algorithms
I need a hashing algorithm to search find data in my random file from my database. I used to search through every record in the file until fields matched, but this will be time consuming with the new database as it has the potential to hold a great number of records. I understand the basic concept of hashing algorithms, and I can write them quite happily. The problem that I'm faced with is collisions. I can produce an algorithm that will put the record 1 or more places where it should go to avoid collisions, but this means that I will be searching record by record after the desired space to find the record. Basically, I was wondering if there is a technique that I am not aware of that perfects the transition from fields to a record number to minimise colisions and minimise code. Cqan anyone help?

Hashing Algorithms
I'm currently studying some hashing algorithms such as md2, md4, md5, sha1 and sha2. while searching on several search engines i noticed that md2 and md4 sources aren't available (at least i didn't find any).
I was hopping that someone here had implementations of those 2 algorithms.
I did search along the forums and google but i had no luck at all.

Not related with this specific thread, i was searching for unicode convertion, strconv("my text", vbFromUnicode, 1031) didn't help me much _or_ i didn't see any difference on the 2 results.

Greetings

Desperately Need Help With MD5 Hashing
Hi all,
I have never touched cryptography. I'm working on a project that is almost finished - what all I need to do is encrypt a string with a MD5 & salt.

Can someone please point me in correct direction?

Thanks!!

edit: VB6 professional

If you hash a file, is there a way to unhash it? I have a class that uses the MD5 and SHA hash algorithms, and I just came up with an idea for a program that will hash any type of text file in Windows.

Simple Hashing
I want to write code for a simple hashing algo, which I think many will know.

I want to store a few options for my application. Each option is Boolean type, so it can have a value of either True or False, or 1 or zero. If I decide to store each option in a separate setting in the registry/database/INI file, I shall require a few entries. In order to reduce these entries I want to use a simple algorithm so I get only one value, from which I can tell the True/False state of each option.

For this I shall use the numbers 1, 2, 4, 8, 16, 32 and so on to denote each option. 0 will be the value of my setting. If an option is selected, it will be added to the setting. Whatever be the combination of options chosen, I shall always get a unique value for a unique combination.

For e.g.

Code:
Option A 1
Option B 2
Option C 4
Option D 8
Option E 16

If user selects only Option A, Setting = 1
If user selects A and B, Setting = 3
If user selects Option E, Setting = 16
If user selects all 5, Setting = 31

So far so good. I can generate the value of the Setting by looking at the options selected. Now, I want to know how I can determine which options have been selected by looking at the value of the Setting. For e.g. if the Setting value is 17, I want an algo that will tell me 17 = 16 + 1, or in other words option A and E have been selected.

.

Hashing A File
Hey guys, I need a bit of help. I need a way to "finger print" a file, and I heard hashing is the way of doing that. I have tried MD5 to hash, but it's way too slow to use. I was wondering if there's any faster algorithims with a built in file hashing routine. Thanks

Hashing/ Encrypted Value
Can some one give me a good encryption algorithm which
we have to decrypt using
name varchar(6)
sex char 1
birthdate date
employeecode char(7)
timesalaryprocessed

to be used to print in an account ledger
so that any bogus cheque issued can be checked for verification

Hashing Functions In VB6
Are there any libraries or hashing functions that I can use in windows that will allow me to hash a file? (i.e. SHA or MD5)

Hashing With Cryptlib 3.x
I have no problem hashing with Cryptlib 3.x up to SHA-256. What I cannot do is hash SHA-384 or SHA-512 with Cryptlib. Does anyone have an example or can point me in the right direction. I have read the manual and can not find a reference to accessing these two hashes other than they are available. Thank you in advance for any guidance.

Hashing Solution Needed
I am working on a very simple prog that checks if files have copied correctly before the original is removed.
I am using the md5 module written in VB
However, it takes extremely long to hash a 30Mb file - nevermind 700Mb ones - compared to a command screen version of the md5 which is more or less instantanious.
Is there a way to retrieve the hash from the command screen or a DLL made in a more efficient language such as C? preferbly one that doesn't throw any tantrums with passing strings....
I never thought the inefficiency difference between two languages could be so clearly demonstrated...

Hashing Files Using Capicom
VB Code:
Private Sub cmdHash_Click()Dim hashtext As New HashedDataDim textmessage As String textmessage = Trim(PText.Text) If Not Len(textmessage) > 0 ThenMsgBox " Enter Text to Hash", vbInformation, " Enter text"PText.SetFocusExit SubEnd If If hash(0).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_SHA1End If If hash(1).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_MD2End If If hash(2).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_MD4End If If hash(3).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_MD5End If hashtext.hash (textmessage)Htext.Text = hashtext.valueEnd Sub

the above code works for text strings and loaded text files
any idea how i can extend this functionality to get the hash of any file
first tell me if teh above code is correct

Hashing Files With Capicom
VB Code:
Private Sub cmdHash_Click()Dim hashtext As New HashedDataDim textmessage As String textmessage = Trim(PText.Text) If Not Len(textmessage) > 0 ThenMsgBox " Enter Text to Hash", vbInformation, " Enter text"PText.SetFocusExit SubEnd If If hash(0).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_SHA1End If If hash(1).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_MD2End If If hash(2).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_MD4End If If hash(3).value = True Thenhashtext.Algorithm = CAPICOM_HASH_ALGORITHM_MD5End If hashtext.hash (textmessage)Htext.Text = hashtext.valueEnd Sub

the above code works for text strings and loaded text files
any idea how i can extend this functionality to get the hash of any file
first tell me if teh above code is correct

Fastest Hashing Method?
What is the fastest hashing method? The one's I know of are MD5, SHA, and CRC32/16. Most of them do the same, right? Thanks guys.

Hashing Multiple Files With Md5
Is there a way to hash each file in a directory individually? I want to use the common dialog to open a folder and select some or all of the files in that directory and hash each one individually with MD5.
Getting it to work with just one file was not too difficult, but I am unable to find any information on how to do this on all of the files in a directory. If I try to turn on the multiple file selection in the common dialog, I can select multiple files but can't loop through each one individually. It tells me that I can't write to the array (declared as: "Dim Selected_Files()"

Does anyone know a a resource for this?

Yuton

File Hashing Using CAPICOM
Hi all,

i've to write using vb6 code to make file hashing.
The file can be also a .doc or .xls or .pdf or .tif so can be also big.

i'm a newby so i'd like to ask you some insight or idea or where to find examples or documentation.
I've found a lot information about certificates, digital sign in VB c++ or c but nothing really helpfull in vb& for a beginner like me

thank you very much

Mik

Can Parts Of CAPICOM Hashing Be Unsupported?
Hello,

Whenever I try to create SHA256, SHA384 or SHA512 hashes I get the following error:

-2138568448
The requested operation is not supported in this platform.

Are these three algorithms unsupported by CAPICOM or is this something my windows (xp) installation is missing?

Thanks,

Walnuts // Sven

Encryption / Hashing Method Which Can Be Used In PHP AND VB For My Passwords?
hey ya,

Does any one know a Sub Function / Routine, which i can use for PHP and VB which will both give the exact same result?

Say in php:

PHP Code:

and vb:

VB Code:
Dim HasedPass as stringHashedPass = Module1.Function("My Password Here")

..? cuz i need to encrypt my users password / hash em, so as to protect there Data,

But i need to be able to use the same password in my website, and in my Chat Server application....

MD5 Hash
hi, is the some kind of MD5 hash function in VB tat does the same as the one in PHP or is there an easy way to work it out?

i just want to hash a simple text string (i think). its for an encryption function i have in PHP and im trying to re-write it in VB. so far i think i just need it to work with plain text

LM Hash In Vb
Hi, how can I get a LM (Lan Manager) hash from a string in VB?
I've been looking all over but I can't find it anywhere.

MD4 Hash...
I have looked on Google and have gotten tons of things concerning MD4 hashes. Currently, I am using an OCX control to calculate the hashes. However, I want actually VB code to use instead of an OCX. Do any of you know where I can find something to help me with this? I have looked through some source code, but none of it makes sense to me. (I have currently researched Rehash, Crypto API, and other source codes. The OCX I am using is EDCrypt.)

Hash Help
Thanks to BillSoo for this code...
Code:
Private Function HashPassword(ByVal pw As String) As Long
Dim varChar As Long, varTemp As Long

For varChar = 1 To Len(pw)
varTemp = Asc(Mid\$(pw, varChar, 1)) Xor varTemp
Next varChar
Call Rnd(-1)
Randomize varTemp
HashPassword = (Rnd() * &H7FFFFFFF) And &HFFFFFFFF
End Function
My question is, is there any way to "un-hash" so you could see the string that you originally started with before you hashed? Thanks!

Hash
is there such thing as a hash in visual basic..

a hash is a way to make a dictionary..... for example:

if u wanted to make a program for upper and lower case letters like this

if u tpe a it spits out @

or s it spis out \$

etc..