|
Decrypt
Unencrypt an encrypted string |
FUNCky 6.0® COM Component |
obj.Decrypt( Str [, Key ] )
Returns
Part
Description
obj A FUNCky Object created by a previous call to CreateObject. Str A string to unencrypt. Key A string containing the key used to encrypt. Optional. If not specified, an internal key is used.
A string containing the unencrypted string.Description
Decrypt will take a string containing low order ASCII characters and will unencrypt them based on the key supplied. Key should contain a low order ASCII string equal to the key supplied when Str was originally encrypted.Key should only contain ASCII characters whose values are in the range 0-127. If Key contains characters whose values are greater than 127, the resultant decrypted string runs the risk of containing an embedded null (0). If that happens, Str will not be able to be unencrypted properly since strings end at the first null character it finds.
If Key is not specified, an internal key is used.
The encryption algorithm used is a simple XOR of the character in Str with the character in Key. The character in Key to be xor'ed with the character in Str will have it's high bit temporarily set on so that in case a character from Key is the same as the character from Str the result will not be a null (0). The string containing the key is not modified.
Also note that the algorithm for encrypting and decrypting used by Encrypt and Decrypt is the same. Using Decrypt on an unencrypted string will result in the string being encrypted.
Decrypt will stop decrypting at the first null character it reaches. If you need to decrypt data that has embedded nulls use the function MemDecrypt instead.Example
Str = FUNCky.Encrypt("Password", "MyKey") Str = FUNCky.Decrypt( Str, "MyKey") // Result: "Password"
| See Also | Encrypt ChrSwap |
|
Copyright© 1988-2012 dLESKO® Inc. All rights reserved. |