encrypting a field in a dbf file 
Author Message
 encrypting a field in a dbf file

Does anyone know of a way to encrypt or otherwise hide fields in a database.
The application I have in mind is a database containing test questions
,feedback, and answer key.  I want to hide the key from the test taker.

Any thoughts, suggestions would be welcome.  If such a facility is not
available in Foxpro, then is there a workaround or third party solution?

Many Thanks,
Ralph Locklin
**********************************************************************

Phone: (814) 865- 2110           generic disclaimer
**********************************************************************



Mon, 12 Aug 1996 00:09:22 GMT  
 encrypting a field in a dbf file

Quote:

>Does anyone know of a way to encrypt or otherwise hide fields in a database.
>The application I have in mind is a database containing test questions
>,feedback, and answer key.  I want to hide the key from the test taker.
>Any thoughts, suggestions would be welcome.  If such a facility is not
>available in Foxpro, then is there a workaround or third party solution?

Simply include only those fields that you want the user to see in
the FIELDS list option of the BROWSE or EDIT/CHANGE command.

There is a way to encrypt and decrypt a field. The function name
is STR...() something. Take a look at the function list for
string handling. This function uses two strings as a conversion table.
If a character in string1 (=field) is found in string2 it is replaced
by the corresponding character in string3.

Hope this helps.

_arto



Tue, 13 Aug 1996 04:30:50 GMT  
 encrypting a field in a dbf file

Quote:
>Simply include only those fields that you want the user to see in
>the FIELDS list option of the BROWSE or EDIT/CHANGE command.

>There is a way to encrypt and decrypt a field. The function name
>is STR...() something. Take a look at the function list for
>string handling. This function uses two strings as a conversion table.
>If a character in string1 (=field) is found in string2 it is replaced
>by the corresponding character in string3.

>Hope this helps.

>_arto

(The function for translating is STRTRAN())

Here is a couple of functions that I use to encode or decode with a key. Maybe not the best, but they work.

function Encode
parameters m_text, m_key
        *** Local Variables ***
        * m_string1 is the first translation string set
        * m_string2 is the second translation string set
        * m_rotate is the # times to rotate the string
        * m_length is the length of the key
        * m_txtlength
        * m_coded is the encoded string
        * m_key2 is a copy of the key
        * m_pos is position of translation
        private m_string1, m_string2, m_rotate, m_length, m_coded, m_key2

!!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        m_rotate = 0
        m_length = len(m_key)
        m_txtlength = len(m_text)
        m_coded = ""
        m_pos = 0
        do while m_pos < m_txtlength
                m_pos = m_pos + 1
                m_key2 = m_key
                do while len(m_key2) > 0
                        m_rotate = int(asc(left(m_key2,1))/m_length)
                        m_key2 = right(m_key2,len(m_key2)-1)
                        m_string1 = right(m_string1,130-m_rotate)+left(m_string1,m_rotate)
                enddo
                m_coded = m_coded + ChrTran(substr(m_text,m_pos,1),m_string1,m_string2)
        enddo
        return (m_coded)

function Decode
parameters m_text, m_key
        *** Local Variables ***
        * m_string1 is the first translation string set
        * m_string2 is the second translation string set
        * m_rotate is the # times to rotate the string
        * m_length is the length of the key
        * m_txtlength
        * m_coded is the encoded string
        * m_key2 is a copy of the key
        * m_pos is position of translation
        private m_string1, m_string2, m_rotate, m_length, m_coded, m_key2

!!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        m_rotate = 0
        m_length = len(m_key)
        m_txtlength = len(m_text)
        m_coded = ""
        m_pos = 0
        do while m_pos < m_txtlength
                m_pos = m_pos + 1
                m_key2 = m_key
                do while len(m_key2) > 0
                        m_rotate = int(asc(left(m_key2,1))/m_length)
                        m_key2 = right(m_key2,len(m_key2)-1)
                        m_string1 = right(m_string1,130-m_rotate)+left(m_string1,m_rotate)
                enddo
                m_coded = m_coded + ChrTran(substr(m_text,m_pos,1),m_string2,m_string1)
        enddo
        return (m_coded)

--------------------------------------------------------------------------
     MegaWatt                         |    _____  _____  _____   _   _
                                      |   |__  / | ___ || ___ \ | | | |
AKA  Aaron L. Bratcher                |     / /  | |_| || |_/ / | | | |
     University of Chicago            |    / /__ | ___ ||  __/  |_| |_|

--------------------------------------------------------------------------



Tue, 13 Aug 1996 20:51:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. encrypt .dbf files??

2. encrypt .dbf files??

3. encrypted DBF within .APP file

4. Encrypted DBF files

5. How can I encrypt .dbf file?

6. Encrypt and decrypt dbf file

7. How can I Encrypt a dbf table?

8. How to index memo fields in a dbf file

9. Can anyone add 2 fields to a dbf file please

10. Encrypt a memo field

11. Character Fields with encrypted Data

12. encrypting fields

 

 
Powered by phpBB® Forum Software