Encrypt/Decrypt in fP

Laura Brody laura at hvcomputer.com
Fri Nov 5 15:35:05 PST 2004


On Fri, 5 Nov 2004 17:19:23 -0500, Mike Rathburn <mike at datadoit.com> wrote:

> |On Fri, 5 Nov 2004 15:27:04 -0500, Mike Rathburn
> |<mike at datadoit.com> wrote:
> |
> |> |Mike Rathburn wrote:
> |> |>
> |> |> fP 5; Winderz
> |> |>
> |> |> I have a text field that needs to be encrypted during an
> |> |export routine,
> |> |> then later decrypted during an import routine.  Does anyone
> |> |know of a simple
> |> |> way to do this in fP on Windows?  Perhaps know of a
> |> |third-party utility that
> |> |> the field value can be run through at export time?  The file
> |> |that is created
> |> |> does not need encryption.  Just the data field.
> |> |
> |> |How secure does this encryption need to be?
> |> |
> |> |+-------------------------+--------------------+---------------
> |>
> |> Just encrypted enough that any normal Joe can't look at a
> |few of these and
> |> tell they're Tax ID's.  I can even expand all the way up to
> |32 characters
> |> from 9.
> |
> |	Can I assume that the field contains just numbers?
> |If that is the case, how about running the number through
> |BASE() and change it from base 10 to say base 36 and then
> |back again at the other side?
> |
> |	If you have alphanumeric data, I wrote a base64/mime
> |encryption subroutine in filePro. Throw me a bone and I'll
> |share it with you.
> |--
> |Laura Brody, Publisher of the filePro Developer's Journal
> ----------------------------------
>
> Yes!  That sounds like what I'm looking for.  Doesn't have to be 'real'
> encryption (though would be nice).  Do you have a short sample of the
> command for export and subsequent import?

This is straight out of Laura's filePro Help Files and Quick
Reference Guide product (which you already have).

------------------------------------------------------------
v4.5   \r n = BASE(n,inbase [,outbase] ) \r - Returns the number in the
		first parameter, in the base of the third parameter.
		If outbase is omitted, base 10 is used.

Note: Can convert a number between any base from base 2 to base 36.

Example:

@keyT   if: ' Base conversion routine
       then: input popup x(20,*) "Number to convert?"
       then: input popup i(2,.0) "Base of this number? (2-36)"
       then: input popup o(2,.0) "Base of result? (2-36)"
       then: r = base(x,i,o)
       then: msgbox r < "= base(" { x { "," { i { "," { o { ")"

    test input:
	DEADBEEF = base("3735928559","10","16")
	1PS9WXB = base("DEADBEEF","16","36")
	11100011 = base("227","10","2")
	
------------------------------------------------------

For your project, you would want to do something like this:

then: export expfile=(filename) ...
then: expfile(1) = 1
then: expfile(2) = 2
   if: ' In this example, field 3 contains the tax ID number.
then: ' Strip out any - symbols with xlate, then convert to base 36.
then: expfile(3) = base(xlate(3,"-",""),"10","36")
then: expfile(4) = 4


For the import, just change the value back....

then: import ifile=(filename) ....
then: 1 = ifile(1)
then: 2 = ifile(2)
then: 3 = base(ifile(3),"36","10")

Few things in this world are this easy.
-- 
Laura Brody, Publisher of the filePro Developer's Journal
+------------- Hudson Valley Computer Associates, Inc ----------+
| PO Box 859 120 Sixth Street    http://www.hvcomputer.com      |
| Verplanck, NY 10596-0859       Voice mail: (914) 739-5004     |
+------ PC repair locally, filePro programming globally --------+


More information about the Filepro-list mailing list