From: Tom Szabo on 13 Jul 2010 09:33 Hi All, Just wondering how can I do MD5 encoding in VO2.7? TIA Tom
From: Carlos Rocha on 13 Jul 2010 11:31 Hi Tom, I use this. Is very fast http://www.doossier.com/vo/md5.zip > Hi All, > > Just wondering how can I do MD5 encoding in VO2.7? > > TIA > > Tom > > -- Carlos Rocha
From: Urs Eggmann on 13 Jul 2010 16:23 Hallo Tom, Another possibility for Files and strings with aamd532.dll FUNCTION MD5File( cFileName AS STRING ) AS STRING PASCAL LOCAL pszRetVal, pszFileName AS PSZ LOCAL cRetVal AS STRING pszRetVal := StringAlloc( Space( 32 ) ) pszFileName := StringAlloc( cFileName ) MDFile( pszFileName, pszRetVal ) cRetVal := Psz2String( pszRetVal ) MemFree( pszRetVal ) MemFree( pszFileName ) RETURN cRetVal FUNCTION MD5String( cString AS STRING ) AS STRING PASCAL LOCAL pszRetVal, pszString AS PSZ LOCAL nLen AS DWORD LOCAL cRetVal AS STRING pszRetVal := StringAlloc( Space( 32 ) ) pszString := StringAlloc( cString ) nLen := SLen( cString ) MDStringFix( pszString, nLen, pszRetVal ) cRetVal := Psz2String( pszRetVal ) MemFree( pszRetVal ) MemFree( pszString ) RETURN cRetVal _DLL FUNCTION MDFile( pszFileName AS PSZ, pszRetVal AS PSZ ) AS VOID PASCAL:AAMD532.MDFile _DLL FUNCTION MDStringFix( pszString AS PSZ, nStrLen AS DWORD, pszRetVal AS PSZ ) AS VOID PASCAL:AAMD532.MDStringFix DEFINE cmxBoxReplyYes := 6 Download dll: http://www.dlldump.com/dll-files/A_1.html regards Urs "Tom Szabo" <tom(a)intersoft.net.au> schrieb im Newsbeitrag news:4c3c6b1d(a)dnews.tpgi.com.au... > Hi All, > > Just wondering how can I do MD5 encoding in VO2.7? > > TIA > > Tom >
From: Marc Verkade [Marti] on 14 Jul 2010 08:55 Ginny's MD5 with ADVAPI.DLL DEFINE CALG_MD5 :=((4 << 13) + (0) + 3) DEFINE CRYPT_NEWKEYSET :=0x00000008 _DLL FUNCTION CryptAcquireContext(phProv AS DWORD PTR, pszContainer AS PSZ,pszProvider AS PSZ, dwProvType AS DWORD, dwFlags AS DWORD) AS LOGIC PASCAL:advapi32.CryptAcquireContextA _DLL FUNCTION CryptCreateHash(hProv AS DWORD, Algid AS DWORD, hKey AS DWORD,dwFlags AS DWORD, phHash AS DWORD PTR) AS LOGIC PASCAL:advapi32.CryptCreateHash _DLL FUNCTION CryptDestroyHash(hHash AS DWORD) AS LOGIC PASCAL:advapi32.CryptDestroyHash _DLL FUNCTION CryptGetHashParam(hHash AS DWORD, dwParam AS DWORD, pbData AS PTR, pdwDataLen AS DWORD PTR, dwFlags AS DWORD) AS LOGIC PASCAL:advapi32.CryptGetHashParam _DLL FUNCTION CryptHashData(hHash AS DWORD, pData AS PTR, dwDataLen AS DWORD, dwFlags AS DWORD) AS LOGIC PASCAL:advapi32.CryptHashData _DLL FUNCTION CryptReleaseContext(hProv AS DWORD, dwFlags AS DWORD) AS LOGIC PASCAL:advapi32.CryptReleaseContext DEFINE HP_HASHSIZE :=0x0004 // Hash value size DEFINE HP_HASHVAL :=0x0002 // Hash value DEFINE PROV_RSA_FULL :=1 FUNCTION MC_MD5(cdata AS STRING,cHashValue REF STRING) AS LOGIC LOCAL lresult AS LOGIC /* De:Ginny Caughey (70714.1741(a)compuserve.com) Assunto:Re: MD5 in VO? Newsgroups:comp.lang.clipper.visual-objects Data:2000-09-19 12:35:03 PST Sligthly adapted by Adriano Rui Gominho // v1.5b 30-Set-2004 17:51:48 */ LOCAL hCryptProvider AS DWORD LOCAL hHash AS DWORD LOCAL dwDataLen AS DWORD LOCAL pHashData AS PTR LOCAL dwHashLen AS DWORD LOCAL cError AS USUAL dwDataLen := Len(cData) BEGIN SEQUENCE // Acquire handle to default provider IF !CryptAcquireContext( ; @hCryptProvider, ; // PTR for CSP NULL_PTR, ; // Container name NULL_PTR, ; // Provider name PROV_RSA_FULL, ; // Provider type 0) // Flags cError := "Could not acquire crypto context." IF !CryptAcquireContext( ; @hCryptProvider, ; // PTR for CSP NULL_PTR, ; // Container name NULL_PTR, ; // Provider name PROV_RSA_FULL, ; // Provider type CRYPT_NEWKEYSET) // Flags cError := "Could not acquire crypto context." BREAK ENDIF ENDIF // MessageBox(0, PSZ("Crypto context acquired"), PSZ("Success"), MB_OK) // Create a hash object IF !CryptCreateHash(; hCryptProvider, ; // CSP provider CALG_MD5, ; // Which hash algorithm 0, ; // Key 0, ; // Must be zero @hHash) // Hash object handle cError := "Could not create hash object" BREAK ENDIF // essageBox(0, PSZ("Hash object created"), PSZ("Success"), MB_OK) // Add the data you want hashed to the hash object IF !CryptHashData(; hHash, ; // Hash object handle String2Psz(cData), ; // Ptr to data dwDataLen, ; // Length of data 0) // Flags cError := "Could not add data to hash object" BREAK ENDIF // MessageBox(0, PSZ("Data added to hash object"), PSZ("Success"), MB_OK) // Get size of hash value and allocate memory for it IF !CryptGetHashParam( ; hHash, ; // Hash object handle HP_HASHSIZE, ; // We want hash size NULL_PTR, ; @dwHashLen, ; // Length filled in here 0) cError := "Could not get hash size" BREAK ENDIF // MessageBox(0, PSZ("Hash size is "+AsString(dwHashLen)), PSZ("Success"),MB_OK) pHashData := MemAlloc(dwHashLen) // Now get hash value IF !CryptGetHashParam( ; hHash, ; // Hash object handle HP_HASHVAL, ; // We want hash value pHashData, ; // Hash value filled in here @dwHashLen, ; // Hash length 0) IF GetLastError() == ERROR_MORE_DATA // Allocate more memory MemFree(pHashData) pHashData := MemAlloc(dwHashLen) IF !CryptGetHashParam( ; hHash, ; // Hash object handle HP_HASHVAL, ; // We want hash value pHashData, ; // Hash value filled in here @dwHashLen, ; // Hash length 0) cError := "Still can't get hash value" BREAK ENDIF ELSE cError := "Could not get hash value" BREAK ENDIF ENDIF // MessageBox(0, PSZ("Hash value is "+Mem2String(pHashData, dwHashLen)),PSZ("Success"), MB_OK) cHashValue:=Mem2String(pHashData, dwHashLen) lresult:=TRUE RECOVER #IFDEF __DEBUG__ MessageBox(0, PSZ(cError), PSZ("Error"), MB_OK) #ENDIF END SEQUENCE // Clean up IF pHashData != NULL_PTR MemFree(pHashData) ENDIF IF hHash > 0 CryptDestroyHash(hHash) ENDIF // Release the CSP IF hCryptProvider > 0 CryptReleaseContext(hCryptProvider, 0) ENDIF RETURN lresult FUNCTION MC_HexMD5(cdata AS STRING,cHashValue REF STRING) AS LOGIC // v1.5b 30-Set-2004 17:58:46 LOCAL lresult AS LOGIC IF MC_MD5(cdata,@cHashValue) cHashValue:=AsHexString(cHashValue) cHashValue:=StrTran(cHashValue," ",NULL_STRING) lresult:=TRUE ENDIF RETURN lresult "Tom Szabo" <tom(a)intersoft.net.au> schreef in bericht news:4c3c6b1d(a)dnews.tpgi.com.au... > Hi All, > > Just wondering how can I do MD5 encoding in VO2.7? > > TIA > > Tom >
From: Carlos Rocha on 14 Jul 2010 10:10 Remarkable work from Ginny, but too slow. That's why I made my own (using a public algorithm). > Ginny's MD5 with ADVAPI.DLL > -- Carlos Rocha
|
Pages: 1 Prev: Win98 /real mode Next: bBrowser and delete of multiple selection |