Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FlexFile Reference Guide - <b>v_setkey()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 V_SETKEY()
 Set a key or password for FlexFile encryption
-------------------------------------------------------------------------------

 Syntax

    V_SETKEY( <cPassWord> )   ->    NIL

 Arguments

    <cPassWord> is any ten character string.  It must be at least one
    character and will be truncated to 10 if more characters are supplied.

 Returns

    NIL

 Description

    V_SETKEY() affects the return values of V_ENCRYPT() and V_DECRYPT().
    Essentially, <cPassWord> is a password that is used to encrypt a string
    and must be the same in order to decrypt the string.  Once set, the
    <cPassWord> is stored statically in memory.

    So, for example, you can set a password when your user starts a system
    (and enters his/her password) and use that password for the remainder
    of the session.  All strings V_ENCRYPT()ed with a particular
    <cPassWord> can only be V_DECRYPT()ed by using the same <cPassWord>.

 Examples

    LOCAL cSecure, cOriginal, cJunk

    // Set the key to my dog's name.
    V_SETKEY( "Tally" )

    // Encrypt a character string.  Store the result in <cSecure>.
    cSecure = V_ENCRYPT( "Just try to decode <cSecure> without my dog." )

    // Later, decode the secured string with the help of my golden.
    // Note that the <cPassWord> is being changed.
    V_SETKEY( "Junk" )

    // Because the <cPassWord> has been changed, the resulting string
    // will be unreadable.
    cJunk = V_DECRYPT( cSecure )

    // Now we change the <cPassWord> back to what was used during
    // the V_ENCRYPT()ion and the string will be properly restored.
    V_SETKEY( "Tally" )
    cOriginal = V_DECRYPT( cSecure )

See Also: V_ENCRYPT() V_DECRYPT()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson