IMPORTANT
http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,db662a8f-d47c-46c8-b0d2-a591c20d024b.aspx
Bigger but still relatively smallThe hash functions added some size to the FLL that now weighs in at about (108 KB), but I think with everything this FLL offers in the way of encryption and hashing that it is still a pretty respectable size.
Additional information on the implemented hash functionsFor additional information on the hash functions now accessible to Visual FoxPro refer to the following links:
http://en.wikipedia.org/wiki/SHA_hash_functionshttp://en.wikipedia.org/wiki/MD5http://en.wikipedia.org/wiki/RIPEMD-160
ReadMe.txtI've included a ReadMe.txt with the download that shows all of the different functions now available in the vfpencryption.fll. I thought this might be a good thing to have with the FLL should someone stumble acrossed it in the future and not know about this blog. Also, it gives me a place to stick George Anescue's disclaimer (he's certainly entitled as the work he's done is great and I appreciate him allowing other developers such as myself to use and modify it freely). Here is some information from the ReadMe.txt about the Hash() function:Function SignatureHash(cStringtoHash[, nHashType])
ParameterscString: String to return hash fornHashType: (possible values and corresponding hash)1 = SHA1 (a.k.a SHA160) - 160 bit Digest2 = SHA256 - 256 bit Digest3 = SHA384 - 384 bit Digest4 = SHA512 (default hash type) - 512 bit Digest5 = MD5 - 128 bit Digest6 = RIPEMD128 - 128 bit Digest7 = RIPEMD256 - 256 bit Digest
Though not always true, it can be generally said of these hash algorithms that the longer the Digest is the more secure the hash is. It would be extremely difficult to find a collision for a string hashed with SHA512, which is the default for this Visual FoxPro Hash() function. A collision, simply put, is when you find another string that would produce the same hash.
In order to represent hashes in the most common form of hexBinary use Visual FoxPro's STRCONV() function. For example:?STRCONV(Hash("Some String"), 15)
Download and Code SampleAs I am adding to this FLL, my examples are designed to just give you enough so you know how to use the new functions being implemented. I will be back at a later time with blog entries that detail the use of this FLL in real world situations for Visual FoxPro. Here is the download link for the FLL and an example of its use:
Download the VFP Encryption FLL (50 KB approx.)
*!* Example of Use *!*DIMENSION aryHashTypes(7) && used just for this example, not necessary in production codearyHashTypes(1) = "SHA1"aryHashTypes(2) = "SHA256"aryHashTypes(3) = "SHA384"aryHashTypes(4) = "SHA512 (default hash type)"aryHashTypes(5) = "MD5"aryHashTypes(6) = "RIPEMD128"aryHashTypes(7) = "RIPEMD256"
CLEARSET LIBRARY TO LOCFILE("vfpencryption.fll")
LOCAL lnCounter, lcHashDigestFOR lnCounter = 1 TO 7 && iterate through all available hashes ?aryHashTypes(lnCounter) lcHashDigest = Hash("Visual FoxPro Rocks!", lnCounter) && here is the actual function in use ?"Binary Characters:" ?lcHashDigest ?"hexBinary Equivalent:" ?STRCONV(lcHashDigest, 15) && Easy way to get the hexBinary equivalent ?ENDFOR
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u