You have to declare and pass sHexDigest string by reference. See corrections below
>I'm trying to use the cryptoSys PKI Library, but I'm facing a simple problem with the DLL. I use the following code:
>
>
>*-- Get the hash of the data with cryptPKI
>local lcHash as Character, lnKeyLen as Integer
>
declare long HASH_HexFromFile in diCrPKI.dll string @ sHexDigest, ;
> long nLenHex, ;
> string stringFile, ;
> long nOptions
>
>lcHash = space(40)
lnKeyLen = HASH_HexFromFile(@lcHash, 40, 'myFile.txt', 0)
>? 'cryptPKI', lnKeyLen, lcHash
>
>
>The function HASH_HexFromFile reads the file, and puts the hash into lcHash. 40 is the size of the SHA1 hash, and the last parameter (zero) is the hash method, SHA1 in this case.
>The function returns OK, as it returns 40 (the size of the produced hash), but the variable lcHash is empty.
>I have tryed to set lcHash by reference (although in the documentation it says is byVal), or to change lcHash to public, but it still is an empty string.
>
>Some ideas on how to get the right results?
>Thanks a lot,
>Javier.
--sb--