>*======================================================================================== >* Returns the hash value of a string. >*======================================================================================== >LParameter tcString > > #include wincrypt.h > > Local loCrypt, lcHash > > * Special version of _CryptAPI that doesn't hide all methodss > loCrypt = NewObject("_CryptApi","_CryptX.vcx") > > Local lnHashHandle, lnRet, lnLength, lcHash > lnHashHandle = 0 > lcHash = NULL > loCrypt.CryptCreateHash( loCrypt.hProviderHandle, dnCALG_SHA, 0, 0, @lnHashHandle ) > > If loCrypt.nlastapierror = 0 > loCrypt.CryptHashData( m.lnHashHandle, m.tcString, Len(m.tcString), 0 ) > If loCrypt.nlastapierror = 0 > Declare Long CryptGetHashParam in Win32API ; > Long hHash, ; > Long dwParam, ; > Long @pbData, ; > Long @pdwDataLen, ; > Long dwFlags > lnLength = 0 > lnRet = CryptGetHashParam(m.lnHashHandle, dnHP_HASHSIZE, @lnLength, 4, 0) > If m.lnRet # 0 > Declare Long CryptGetHashParam in Win32API ; > Long hHash, ; > Long dwParam, ; > String @pbData, ; > Long @pdwDataLen, ; > Long dwFlags > lcHash = replicate( Chr(0), m.lnLength ) > lnRet = CryptGetHashParam(m.lnHashHandle, dnHP_HASHVAL, @lcHash, m.lnLength, 0) > If m.lnRet == 0 > lcHash = NULL > EndIf > EndIf > EndIf > loCrypt.CryptDestroyHash( m.lnHashHandle ) > EndIf > > >Return m.lcHash >>This code assumes that you have a modified version of the _CryptApi.vcx library which has all hidden members set to public. On Vista you can avoid the VCX altogether. Let me know if you also need a Vista-only code sample.