Thursday, February 23, 2006

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)


Function HASHFILE()

Signature: HashFile(cFileName[, nHashType])

Parameters:

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

Return Value:

Binary Character Data - the hash for cFileName.

Remarks:

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

Thursday, February 23, 2006 7:01:24 AM (Central Standard Time, UTC-06:00)  #    Comments [7]
Saturday, February 25, 2006 5:36:47 PM (Central Standard Time, UTC-06:00)
Craig,

The new update works like a charm.

Thank you very much,
Malcolm
Wednesday, March 01, 2006 1:22:16 PM (Central Standard Time, UTC-06:00)
Craig,

Thanks for your notes on the encryption library. I'm hoping the request for Framework 2.0 compatible encryption makes the feature cut.

Keep up the great work,
Bryan
Thursday, March 02, 2006 2:13:34 PM (Central Standard Time, UTC-06:00)
There is a typo on your intro page:

We specializing in contract programming
Joe
Thursday, March 02, 2006 10:38:54 PM (Central Standard Time, UTC-06:00)
Hi Joe,

Thank you for bringing this to my attention.
Sunday, March 05, 2006 8:14:25 AM (Central Standard Time, UTC-06:00)
Craig,

Some bugs indeed killed… others, refuse to die!

The RC4 Stream Cipher returns unanticipated characters under certain combinations of Field/Expression Lengths and Password Combinations. CodePage changes do not seem to make a difference. Please take a look.

** Bug Reproduction! **

SET LIBRARY TO VFPEncryption71.FLL

CREATE TABLE myTable (myField C(28))

INSERT INTO myTable (myField) VALUES ("CALLE RAFAEL GIMENEZ")
INSERT INTO myTable (myField) VALUES ("CALLE GONZALO BERCEO")
INSERT INTO myTable (myField) VALUES ("COND COOP EL ALCAZAR")
INSERT INTO myTable (myField) VALUES ("CALLE MANUEL F ROSSY")
INSERT INTO myTable (myField) VALUES ("CALLE EFIGENIO COCO FERRER")
INSERT INTO myTable (myField) VALUES ("CALLE MANUEL JIMENEZ")
INSERT INTO myTable (myField) VALUES ("COND EST DEL BLVD")
INSERT INTO myTable (myField) VALUES ("URB PRADO ALTO")
INSERT INTO myTable (myField) VALUES ("HACIENDA LOMAS")

BROWSE TITLE "Data is Inserted... (No problem!)"
REPLACE ALL MyField WITH ENCRYPT(MyField,"RUSHLIFE",1024)

BROWSE TITLE "Data is Encrypted... (No problem?)"
REPLACE ALL MyField WITH ENCRYPT(MyField,"RUSHLIFE",1024)

BROWSE TITLE "Data is Decrypted... (Bugs!!)"

Thanks once again for your time/efforts!!
Kenneth Tamayo
Monday, March 06, 2006 3:38:55 AM (Central Standard Time, UTC-06:00)
Hi Kenneth,

Great job once again. Newest version of the FLL with this bug fixed is now available. See my latest blog entry.
Thursday, December 20, 2007 2:20:42 AM (Central Standard Time, UTC-06:00)
Craig,

I've been using the FANTASTIC VFPEncryption(71) in several of my applications... All working perfectly... SO MANY THANKS MAN!!!!!!

If you have an opportunity, please re-compile/re-publish the VFPEncryption(80) counterpart....

Again, THANKS THANKS THANKS for all you continue to do and HAPPY HOLIDAYS!!!
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u)  

Enter the code shown (prevents robots):


 

Archive

<August 2008>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456