RATECRYPT() Version 1.2 included below

clipper

    Next

  • 1. Application Slowdown
    Hello, One of our multiprocessor applications started slowing down unexpectedly this week. It is complied under 5.2E, uses Advantage 5.7, and is linked under Blinker. The application starts fine each day at 7:00 AM and creates a DBF for the day, but around noon, after pulling 10-12000 records, it slows to a crawl. When we halt the process, rename the affected DBF, and restart allowing it to create the daily DBF anew, it flys, and we can continue to completion. We then append the data from the morning's file before any additional processing continues. The normal size of a day's file generals ends up between 1-2 megs in size. The application started doing this on June 1. There were no changes to the application, OS, or network done that might have caused this. Any ideas? Thank you.
  • 2. Process Slowdown
    Hello, One of our multiprocessor applications started slowing down unexpectedly this week. It is complied under 5.2E and uses Advantage 5.7. The application starts fine each day at 7:00 AM and creates a DBF for the day, but around noon, after pulling 10-12000 records, it slows to a crawl. When we halt the process, rename the affected DBF, and restart allowing it to create the daily DBF anew, it flys, and we can continue to completion. We then append the data from the morning's file before any additional processing continues. The normal size of a day's file generals ends up between 1-2 megs in size. The application started doing this on June 1. There were no changes to the application, OS, or network done that might have caused this. Any ideas? Thank you.
  • 3. Copying from an 'exclusive' Database ??
    Hi folks, I need to make a copy of a database (and its associated .cdx file) while that same database is opened in 'exclusive' mode. Clipper Tools won't let me do it (with its filecopy function), and the Clipper command: Copy File xxxx TO yyyy also won't let me. Any hints please ??? (of course, I could go thru the agony of completely closing the database after saving record number, etc, etc, but is there anytrhing simpler than that ??) TIA, -Mel Smith
  • 4. COM1: to USB
    Hi, I have to maintain a programm wich transfers files via Modems, Clipper 5.2 and Lib CT The prg uses only Com1 to com3 as output devices, Some portables PC do not have any more com port. Is there a way that an USB port emulates COMn Output? TIA for help Richard

RATECRYPT() Version 1.2 included below

Postby Mel Smith » Sat, 19 Aug 2006 22:17:16 GMT

ear Friends,

Here is Version 1.2 of RateCrypt() below.


Thanks to all

-Mel Smith

------------------- snip -----------------------------

FUNCTION RATECRYPT(cCRYPT,nRATE,cEMPNUM)
// Author: Mel Smith, Aug 17, 2006
// With Lots of Help from the Guys on the c.l.g newsgroup

// Aug 18/06 -- Version 1.2
// 1. Removed Duplicate Code / Re-structured
// 2. Changed NUROUND() to standard ROUND()
// (Thanks to BillRobertson)
// 3. Changed the nMININC 'define' to lessen 'loops'
// (But would like to find a way to eliminate this step)

/*
My wish with this function is to create an encrypted rate which will
'fit' in the same field as the actual rate, but will have a value
that will be obvious (to my function) as either encrypted (or actual).

Thus, this function allows the programmer to 'obscure' an employee's
hourly
Rate from casual viewing (using database viewing software) by his peers.

The technique uses a pseudo Random Number generator copied/modified
from NanForum's rand1.prg

The mods include using the '%' operator (instead of the MOD() function),
and later including an organization's own code (nORGCODE) to
differentiate
it from other orgs who would also use this function.

I also have to deal with variously-structured 'Employee Numbers' which
require some extra coding below. *My* Employee numbers are (for now)
either, for example, 'R1234' or '59028'. So I have to use either
*all* digits or the right-most 4 digits.

*/

#define nB 31415621 // Good old 'PI' is used here
#define nM 100000000 // The widest possible range of values
#define nMIN 60000 // Minimum returned value from encryption
#define nMAX 99999 // Maximum returned value from encryption
#define nMININC 10000 // To 'boost' the nCODEBASE to within limits ----
Version 1.2 change
#define nORGCODE 1234 // Choose Your own private org's code here --
NEVER CHANGE !
#define nMINLENEMP 5 // Minimum input allowable length of employee
number
#define nMINCODERATE 400 // Any value > nMINCODERATE is already encrypted
LOCAL I,nSEED,nEMPVAL,nCODEBASE,nCODERATE,cDIGSTR,nDECRYPRATE

GABORT := .T. // Global 'Abort' indicator for Calling routine
// Assume failure at the outset

IF EMPTY(nRATE) // I won't encrypt a 'zero' Rate
RETURN nRATE
ENDIF

cEMPNUM := ALLTRIM(cEMPNUM)
IF EMPTY(cEMPNUM) .OR. LEN(cEMPNUM) < nMINLENEMP // Faulty Employee Number
RETURN nRATE
ENDIF

// Try to use *both* the n-digit Employee Numbers and also
// the letter + (n-1)-digit Employee Numbers used by other related orgs.

IF ISDIGIT(cEMPNUM) // THEN WE CAN USE ALL n DIGITS
nEMPVAL := VAL(cEMPNUM)
ELSE // ELSE ONLY USE THE RIGHT-MOST n-1 DIGITS
IF .NOT. ISDIGIT(cDIGSTR:=SUBSTR(cEMPNUM,2,10)) // THEN WE HAVE A
NON-CONFORMING EMPNUM
RETURN nRATE
ENDIF
nEMPVAL := VAL(cDIGSTR)
ENDIF
// Now we have a proper Employee 'Number' to work with as part of our seed
// nCodeBase calcs was moved and structure below changed from 1st version

// Modify the 'Seed' for your own organization's purposes

nSEED := nEMPVAL + nORGCODE // The seed is different for each different
// Employee Number (+ the Org's own code)

// This next line is from the NanForum 'Rand1.prg' module and
// authors Gary Baren and 'Glenn'

Re: RATECRYPT() Version 1.2 included below

Postby bill robertson » Sun, 20 Aug 2006 04:21:02 GMT


Hi Mel

Perhaps you will be interested in a mathematically equivalent version of 
your routine. I took the rand1.prg function as you did and scaled it so 
that it would generate numbers in the 60000 - 99999 range that you 
wanted to use. The method uses no round() function and like the xor 
function requires no separate encrypt/decrypte routine.

It is as secure as the rand1() function which isn't all that secure but 
certainly should suffice to obscure the rate. It might be slightly more 
secure if the EmpNo was a prime number. Some of the lines may wrap but I 
cut and pasted so it should compile OK and show you some typical results 
for a fixed rate of 12.50

/*----------------------------------------------------------*/
#define nMin   60000
#define nMax   99999
#define nOrg    1234

Function main()
LOCAL nRow:= 1, nCol:= 0
LOCAL nRate:= 12.50, nEmpNo:= 21343

Clear screen
While nCol < 80
   @ nRow++, nCol say ( nRate:= ft_rand1( nRate, nEmpNo ) ) Picture 
"#####.##"
   @ nRow++, nCol say ( nRate:= ft_rand1( nRate, nEmpNo ) ) Picture 
"#####.##"
   ++nEmpNo
   If nRow > 20
     nRow :=  1
     nCol += 10
   END if
END while
return nil


function ft_rand1(nRate, nEmpNo)
LOCAL nSeed:= nOrg + nEmpNo
LOCAL m := 100000000, b := 31415621
LOCAL nDiff:= nMax - nMin

Return Int(nMin+nDiff*((nSeed:=(nSeed*b+1)%m))/m)-nRate

Re: RATECRYPT() Version 1.2 included below

Postby Mel Smith » Sun, 20 Aug 2006 22:12:54 GMT

Bill,

    It looks short and elegant.
    I'll give it a try this afternoon.

    If it works under my own org's circumstances I'll certainly use it.

Thank you !

-Mel Smith




Similar Threads:

1.RATECRYPT() Version 1.3 included below

Bill & Others:

    Version 1.3 of Ratecrypt is included below:

    This version uses your 'nifty' pseudo-random generator technique.

    What I did was copy your one line 'encrypter', modify a few variables
and defines.
    then place it in my RateCrypt() function.

    I did a test on 2057 employees with their widely varying Rates and
Employee Numbers using
    my year 2000 IBM Aptiva Win98se machine (600MHz).

    Results:    The complete conversion from encrypting a record's Rate
field to an encrypted field (NuRate), then immediately decrypting that same
record from the decrypted NuRate field back into the Rate field took .44
seconds

                    The lowest encrypted Rate was $559.67, the highest was
$983.85.

                    Of the 2057 records, I had 59 records that had duplicate
Encrypted Rates.


Anyway, thanks for all the work !

-Mel Smith

(watch out for Word Wrap below)

----------------------  Version 1.3 of RateCrypt() below ---------------

FUNCTION RATECRYPT(cCRYPT,nRATE,cEMPNUM)
//    Author: Mel Smith,  Aug 17, 2006
//            With Lots of Help from the Guys on the c.l.g newsgroup
//            Especially: Bill Robertson

//    Aug 18/06 -- Version 1.2
//       1. Removed Duplicate Code / Re-structured
//       2. Changed NUROUND() to standard ROUND()
//          (Thanks to BillRobertson)
//       3. Changed the nMININC 'define' to lessen 'loops'
//          (But would like to find a way to eliminate this step)

//    Aug 19/06 -- Version 1.3
//       1. Bill provided a better encrypting algorithm.
//       2. I made slight mods to this algo and
            placed it as one computation below.
//       3. Works great and eliminates the obnoxious loop that
//          was used to set Min and Max return values from the encrypter
//          That is, the 'loops' problem noted above is now gone !
/*
   My wish with this function is to create an encrypted rate which will
   'fit' in the same field as the actual rate, but will have a value
   that will be obvious (to my function) as either encrypted (or actual).

   Thus, this function allows the programmer to 'obscure' an employee's
hourly
   Rate from casual viewing (using database viewing software) by his peers.

   The technique uses a pseudo Random Number generator copied/modified
   from NanForum's rand1.prg, but then modified by Bill Robertson

   The mods include using the '%' operator (instead of the MOD() function),
   and later including an organization's own code (nORGCODE) to
differentiate
   it from other orgs who would also use this function.

   I also have to deal with variously-structured 'Employee Numbers' which
   require some extra coding below. *My* Employee numbers are (for now)
   either, for example,  'R1234'   or '59028'. So I have to use either
   *all* digits or the right-most 4 digits.

*/
#define nB 31415621        // Good old 'PI' is used here
#define nM 100000000       // The widest possible range of values
#define nMIN 60000         // Minimum returned value from encryption
#define nMAX 99999         // Maximum returned value from encryption
#define nDIFF nMAX-nMIN    // The nDIFF definition is used below
#define nMININC 10000      // To 'boost' the nCODEBASE to within limits
#define nORGCODE 1234      // Choose Your own private org's code here -- 
NEVER CHANGE !
#define nMINLENEMP 5       // Minimum input allowable length of employee
number
#define nMINCODERATE 400   //  Any value > nMINCODERATE is already encrypted

LOCAL nEMPVAL,nCODEBASE,nCODERATE,cDIGSTR,nDECRYPRATE

GABORT := .T.  // Global 'Abort' indicator for Calling routine
               // Assume failure at the outset

IF EMPTY(nRATE)   // I won't encrypt a 'zero' Rate
   RETURN nRATE
ENDIF

cEMPNUM := ALLTRIM(cEMPNUM)
IF EMPTY(cEMPNUM) .OR. LEN(cEMPNUM) < nMINLENEMP   // Faulty Employee Number
   RETURN nRATE
ENDIF

// Try to use *both* the n-digit Employee Numbers and also
// the letter + (n-1)-digit Employee Numbers used by other related orgs.

IF ISDIGIT(cEMPNUM)  // THEN WE CAN USE ALL n DIGITS
   nEMPVAL := VAL(cEMPNUM)
ELSE        // ELSE ONLY USE THE RIGHT-MOST n-1 DIGITS
   IF .NOT. ISDIGIT(cDIGSTR:=SUBSTR(cEMPNUM,2,10))  // THEN WE HAVE A
NON-CONFORMING EMPNUM
      RETURN nRATE
   ENDIF
   nEMPVAL := VAL(cDIGSTR)
ENDIF

// Testing Bill Robertson's formula below
// Aug 19/06 -- It now returns an integer
nCODEBASE := Int(nMIN+(nMAX-nMIN)*(((nORGCODE+nEMPVAL)*nB+1)%nM)/nM)

cCRYPT := ALLTRIM(UPPER(cCRYPT))

IF cCRYPT == "E"              // Means to 'E'ncrypt
   IF nRATE > nMINCODERATE    // Already encrypted
      RETURN nRATE      // It is 'already' encrypted --  a Programming Fault
:((
   ENDIF

   nCODERATE := ROUND((nCODEBASE*.01) - nRATE,2)  // and establish the Coded
Rate
   GABORT := .F.           // Signal globally that this encryption worked.
   RETURN nCODERATE        // and Return this Coded Rate

ELSEIF cCRYPT="D"    // MEANS 'D'ecrypt
   IF nRATE <= nMINCODERATE    // Already decrypted
      RETURN nRATE      // It is 'already' decrypted --  a Programming Fault
:((
   ENDIF

   nDECRYPRATE := ROUND(ABS(nRATE - (nCODEBASE*.01)),2)  // and set Coded
Rate
   GABORT := .F.           // Signal globally that this encryption worked.
   RETURN nDECRYPRATE        // and Return this Coded Rate

ENDIF

GABORT := .T.
RETURN nRATE








2.My Completed RATECRYPT() function included below

Dear Friends,


    Here is the 'final' version of my Hourly Rate 'obscurer' (Encryption)
function

    Feel free to use it for your own purposes.  If you find a fault, I'd
like to know about it.

    btw, I have sacrificed elegance with clarity (elegance and speed was
never in my 'toolbox')

    (I'll be making similar functions for Social Insurance Numbers, and
Birth Dates as my client directs.)

-Mel Smith

--------------------   Clip
here -------------------------------------------------
FUNCTION RATECRYPT(cCRYPT,nRATE,cEMPNUM)
//    Author: Mel Smith,  Aug 17, 2006
//           With Lots of Help from the Guys on the c.l.g newsgroup

/*
   My wish with this function is to create an encrypted rate which will
   'fit' in the same field as the actual rate, but will have a value
   that will be obvious (to my function) as either encrypted (or actual).

   Thus, this function allows the programmer to 'obscure' an employee's
hourly
   Rate from casual viewing (using database viewing software) by his peers.

   The technique uses a pseudo Random Number generator copied/modified
   from NanForum's rand1.prg

   The mods include using the '%' operator (instead of the MOD() function),
   and including an organization's own code (nORGCODE) to differentiate
   it from other orgs who would also use this function.

   I also have to deal with variously-structured 'Employee Numbers' which
   require some extra coding below. *My* Employee numbers are (for now)
   either, for example,  'R1234'   or '59028'. So I have to use either
   *all* digits or the right-most 4 digits.

*/

#define nB 31415621        // Good old 'PI' is used here
#define nM 100000000       // The widest possible range of values
#define nMIN 60000         // Minimum returned value from encryption
#define nMAX 99999         // Maximum returned value from encryption
#define nMININC 1000       // To 'boost' the nCODEBASE to within limits
#define nORGCODE 1234      // Choose Your own private org's code here -- 
NEVER CHANGE !
#define nMINLENEMP 5       // Minimum input allowable length of employee
number
#define nMINCODERATE 400   //  Any value > nMINCODERATE is already encrypted

LOCAL I,nSEED,nEMPVAL,nCODEBASE,nCODERATE,cDIGSTR,nDECRYPRATE

GABORT := .T.  // Global 'Abort' indicator for Calling routine
               // Assume failure at the outset

IF EMPTY(nRATE)   // I won't encrypt a 'zero' Rate
   RETURN nRATE
ENDIF

cEMPNUM := ALLTRIM(cEMPNUM)
IF EMPTY(cEMPNUM) .OR. LEN(cEMPNUM) < nMINLENEMP   // Faulty Employee Number
   RETURN nRATE
ENDIF

// Try to use *both* the n-digit Employee Numbers and also
// the letter + (n-1)-digit Employee Numbers used by other related orgs.

IF ISDIGIT(cEMPNUM)  // THEN WE CAN USE ALL n DIGITS
   nEMPVAL := VAL(cEMPNUM)
ELSE        // ELSE ONLY USE THE RIGHT-MOST n-1 DIGITS
   IF .NOT. ISDIGIT(cDIGSTR:=SUBSTR(cEMPNUM,2,10))  // THEN WE HAVE A
NON-CONFORMING EMPNUM
      RETURN nRATE
   ENDIF
   nEMPVAL := VAL(cDIGSTR)
ENDIF
// Now we have a proper Employee 'Number' to work with as part of our seed

cCRYPT := ALLTRIM(UPPER(cCRYPT))

IF cCRYPT == "E"              // Means to 'E'ncrypt
   IF nRATE > nMINCODERATE    // Already encrypted
      RETURN nRATE      // It is 'already' encrypted --  a Programming Fault
:((
   ENDIF

   // Now Modify the 'Seed' for your own organization's purposes

   nSEED := nEMPVAL + nORGCODE      // The seed is different for each
different E
                                    // Employee Number (+ the Org's own
code)

   // This next line is from the NanForum 'Rand1.prg' module and
   // authors Gary Baren and 'Glenn'
   nCODEBASE := nMAX * (( (nSEED * nB + 1) % nM ) / nM)

   // Now bring the nCODERATE within your org's limits
   DO WHILE nCODEBASE < nMIN
      nCODEBASE += nMININC
   ENDDO

   // I use this 'new' rounding routine provided by Fleming Ho in 1994
   // (Substitute your 'own' rounding function in the next line)
   nCODEBASE := NUROUND(nCODEBASE*.01,2)     // Result 500.00 thru 999.99

   nCODERATE := nCODEBASE - nRATE            // and establish the Coded Rate

   GABORT := .F.           // Signal globally that this encryption worked.
   RETURN nCODERATE        // and Return this Coded Rate


ELSEIF cCRYPT="D"    // MEANS 'D'ecrypt
   IF nRATE <= nMINCODERATE    // Already encrypted
      RETURN nRATE      // It is 'already' encrypted --  a Programming Fault
:((
   ENDIF

   // Now Modify the 'Seed' for your own organization's purposes

   nSEED := nEMPVAL + nORGCODE      // The seed is different for each
different E
                                    // Employee Number (+ the Org's own
code)

   // This next line is from the NanForum 'Rand1.prg' module and
   // authors Gary Baren and 'Glenn'
   nCODEBASE := nMAX * (( (nSEED * nB + 1) % nM ) / nM)

   // Now bring the nCODERATE within your org's limits
   DO WHILE nCODEBASE < nMIN
      nCODEBASE += nMININC
   ENDDO

   // I use this 'new' rounding routine provided by Fleming Ho in 1994
   // (Substitute your 'own' rounding function in the next line)
   nCODEBASE := NUROUND(nCODEBASE*.01,2)     // Result 500.00 thru 999.99

   nDECRYPRATE := ABS(nRATE - nCODEBASE)            // and establish the
Coded Rate

   GABORT := .F.           // Signal globally that this encryption worked.
   RETURN nDECRYPRATE        // and Return this Coded Rate

ENDIF
RETURN nRATE               // Should Never Get Here -- Remove later




3.Rich Report version 1.2 with clarion 6

Hi Everyone ,
                    Has anyone managed to get rich report version 1.2 to
work with clarion 6 and as also anyone have had problems contacting solid
software because i have been sending emails to them but no reply.

Olu.



















4.ANN: KSpng version 1.2 released

5.[ANN] new InsiderTools version 1.2 released

Hello!

Eleus Software very happy to announce the InsiderTools library version
1.2!


List of changes in version 1.2
----------------------------

   * new routine insider():procObject(..) returns object for an
callstack
      entry of method call.
   * new routine insider():procBlock(..) returns codeblock for an
callstack
      entry of codeblock call.

   * added support for codeblock's callstack entries in fatal error
handler.
   * enhance of fatal error handler's "Full callstack" section:
         * show parameters even for internal functions
         * show ProcName()/ProcLine() for internal functions (where
            possible)
         * determining BEGIN SEQUENCEs in callstack
         * show types of callstack entries: x++ (Xbase++ call), core
            (internal function) and SEQ (BEGIN SEQUENCE)
         * show only 256 entries of callstack (128 first and 128 last)

To view complete list of changes and updated documentation, please
visit our
site.


About InsiderTools
-------------------

InsiderTools is set of add-on tools for debugging, profiling,
diagnosting
and error checking for Alaska Xbase++.

Short list of features:

  * Extended Callstack API
         Unique addon API for ProcName()/ProcLine(). You can
         retrieve parameters for any entry in callstack, get actual
         object for method call and actual codeblock for codeblock eval
  * Extended Fatal Error Handling
         A lot of infomation about crash: callstacks with all
parameters,
         memory info & stat, etc
  * Extended Memory Information
         All about used memory and allocated variables. Statistics
         about created objects. Retrieving number of references
         to an object or array.
  * Xbase++ Aspect Oriented API
         Simple and powerful tool to debug, log and profile.

check our software:
>  insiderTools: set of debugging, profiling and error checking tools
>  smartGC: addon tool to speedup garbage collector
>  XFuncs: easy extend your app with script functions

6. RfD: Ambiguity in FATAN2 version 1.2

7. JukeboxIn4Th updated (Now version: 1.2)

8. Support for SOAP version 1.2?



Return to clipper

 

Who is online

Users browsing this forum: No registered users and 8 guest