Visual basic 6 hash function

In my application, I need to write a string before saving it to a text file. Does anyone know how to do this?

+5
source share
7 answers

For what purpose do you use a hash? This is important because some hash algorithms, such as MD5, are suitable for some purposes, but not for others.

This link shows the implementation of VB6 MD5 .

+2
source

The CRC32 hash function is used here:

http://www.vbcode.com/asp/showsn.asp?theID=471

+2
source

CAPICOM

CAPICOM.DLL

DIM As String DIM sValue As String

Dim sEncrypedValue as String

Dim oCAP CAPICOM.EncryptedData oCAP = CAPICOM.EncryptedData​​p >

oCAP..Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM_RC4
.SetSecret .Content = sValue end

sEncrypedValue = objCAP.Encrypt(CAPICOM_ENCODE_BASE64)

: oCAP.SetSecret oCAP.Content = sEncrypedValue sValue = oCAP.Decrypt(CAPICOM_ENCODE_BASE64)

+2

( 50 rep)

, , , , , CRC32, :

ByVal Seed As Long = & HEDB88320

, - 30 !

+1

CriptoASP. "ASP" , ActiveX DLL, VB6. , MD2, MD4, MD5 SHA /.

CriptoASP

, - , , COM Doc, CriptoASP, Server.CreateObject VB6.

, .

, FSO ( ).

0

, c

SDBM

sdbm (public redomplementation ndbm). , , . . - hash (i) = hash (i - 1) * 65599 + str [i]; , , - , gawk. [ duff-device], 65599 , . , berkeley db (. sleepycat) .

static unsigned long
sdbm(str)
unsigned char *str;
{
    unsigned long hash = 0;
    int c;

    while (c = *str++)
        hash = c + (hash << 6) + (hash << 16) - hash;

    return hash;
}

vb, . ,

newHash = the character (c) + (previousHashValue * 2^6) + 
                              (previousHashValue * 2^16) - 
                               previousHashValue**
previousHashValue = newHash
0
source

You can implement it in C # .net dll using SHA128Managed

0
source

All Articles