Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFPEncryption question
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01136407
Message ID:
01139254
Views:
15
>In the case you have outlined I would do it like the following...
>
>http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,34321a75-a1fc-4a0e-a9af-17a3c6916d90.aspx
>
>There are no plans to provide the feature you're asking for. However, and I think I read someone else's post that elluded to this, why not use a hash to solve this? For instance, here's a simplistic example where neither the plaintext, key, or ciphertext would be anywhere in the code and yet you could still check that the user entered in the right key (seeing 'DC2F6812CFD76CF41A287FC4F4B0A3213BE094AD' in the code does a hacker no good as it is just a message digest):
>
>
*!* Here's how you check what the user entered
>?CheckUserLicense("12345555666677778888") && user entered a license let's check it
>?CheckUserLicense("11113333444455556666") && user entered another license let's check it
>
>*!* In application itself would be the following function
>*!* Note that neither the key, the plaintext, or even the ciphertext
>*!* exists in the function. We will use what the user entered in
>*!* and check the hash of the resulting ciphertext
>************************************
>FUNCTION CheckUserLicense(tcEnteredByUser)
>************************************
>LOCAL lcPlaintext, lcSecretKey, lcCipherText, lcMessageDigest, llReturn
>m.lcPlaintext = LEFT(m.tcEnteredByUser,4)
>m.lcSecretKey = Right(m.tcEnteredByUser,16)
>SET LIBRARY TO LOCFILE("vfpencryption71.fll")
>m.lcCipherText = Encrypt(m.lcPlaintext, m.lcSecretKey, 0, 0)
>m.lcMessageDigest = STRCONV(Hash(m.lcCipherText,1),15)
>m.llReturn = m.lcMessageDigest = "DC2F6812CFD76CF41A287FC4F4B0A3213BE094AD" && see below
>RETURN m.llReturn
>
>*!* In preparation we need to get the hex equivalent of a hash
>*!* this would be done during development and would not appear in the application
>*!* source code
>*!*	LOCAL lcPlaintext, lcSecretkey, lcCipherText, lcMessageDigest
>*!*	SET LIBRARY TO LOCFILE("vfpencryption71.fll")
>*!*	m.lcPlaintext = "1111"
>*!*	m.lcSecretkey = "3333444455556666"
>*!*	m.lcCipherText = Encrypt(m.lcPlaintext, m.lcSecretKey, 0, 0)
>*!*	m.lcMessageDigest = STRCONV(Hash(m.lcCipherText,1),15)
>*!*	_cliptext = m.lcMessageDigest && put the message digest on the clipboard so we can paste it into our CheckUserLicense
>
Craig,

Thanks for the reply.

That was definitely a great idea. However, this still doesn't satisfy my desire to have a unique key for each user.

Now, I know exactly what I need. I need an algorithm that generates unique keys that may be used as an input for another algorithm which in turn will generate a result that's in certain mathmatical pattern or best yet will yield the same hash.
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform