The functions within this FLL have changed. Please refer to the latest
documention for the VFP Encryption FLL that can be found at the
A new and useful function gets added
Based on a recent request by John Clarke, I’ve added a HashFile() function to the library. The reason this is needed is that the Hash() function receives a string and Visual FoxPro has a string size limit (16,777,184 characters) that makes producing a message digest on files larger than about 16 MB impossible. This new HashFile() function lifts that restriction. Note that it is used exactly as the Hash() function is except that the first parameter is the file you want to hash.
A bug gets squashed
Kenneth Tamayo reported in the comments section of an earlier blog post that RC4 encryption and decryption was failing in certain circumstances. Problem is fixed in this newest library. There are no current bugs in this library that I am aware of. If you find one, please contact me as Kenneth did, either by posting a comment here or via email.
Others have requested changes as well
To others that have requested changes… I haven’t forgotten you. A requested change currently being considered is providing for compatibility with Visual Studio’s encryption. This will involve, among other things, allowing vectors to be specified in the Encrypt, Decrypt, EncryptFile, and DecryptFile functions.
For now, here’s the download for the newest FLL libraries in two C++ flavors and the documentation for the HashFile function that has been added. More complete documentation is available in a previous blog entry.
Download the Latest Version of the VFP Encryption FLL (58 KB approx.)
(compiled with Visual Studio 2005 and requires the C++ 8.0 runtimes)
Download the Latest Version of the VFP Encryption 71 FLL (59 KB approx.)
(compiled with Visual Studio 2003 and requires the C++ 7.1 runtimes)
Signature: HashFile(cFileName[, nHashType])
cFileName – The fullpath and name of an existing file you wish to generate a message digest for
nHashType – The type of hash function to generate. There are currently 7 different hash functions supported
1 = SHA1 (a.k.a SHA160)
2 = SHA256
3 = SHA384
4 = SHA512 *Default
5 = MD5
6 = RIPEMD128
7 = RIPEMD256
Binary Character Data – the hash for cFileName.
The hash is returned as a series of binary characters. However, it is more common to see hashes in a hexBinary format. This can be accomplished in Visual FoxPro by taking the return of the HashFile() function and sending it in as a parameter to the STRCONV() function. For example:
?STRCONV(HashFile(“C:\MyFile.txt”), 15) && hexBinary Hash