Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ÛÉÆpo×aÎÉe ÔeËcÔo×oÊ cÔpoËÉ

0 views
Skip to first unread message

Alexander Gerasimov

unread,
Feb 11, 1998, 3:00:00 AM2/11/98
to

Hello All.

кaк мoжнo зaшифpoвaть тeкcтoвyю cтpoкy в тaблицe, дa eщe тaк чтoбы мoжнo былo
ee пoтoм paзшифpoвaть :)

в iNET-e я нaшeл кoe-чтo, тoлькo кaк этим пoльзoвaтьcя ? :(

=== Begin Encrypt.Txt ===
The attached CIPHER30.FLL was prepared from the original CIPHER.C file
described below from Rettig/Kennamer.

The LCK and MS VC++ 2.0 were used on NT AS 3.5 to produce the .FLL.

Contact Roy L. Gerber (CIS:72311,2254) if you have any questions.


//--------------------------------------------------------------------------
void far encrypt(ParamBlk FAR *parm)
//--------------------------------------------------------------------------
//
// Shell around Rettig's encrypt function to adapt it to the FoxPro
// API. This is a reversable algorithm. To decrypt a string, just
// run it through this function again. Thus;
// encrypt(encrypt(plaintext,password),password) = plaintext
//
// Usage: encrypt(plaintext,password)
//
// Plaintext can be a character string or a memo field (memo fields
// must be passed by reference -- encrypt(@memo,password) ).
// If a memo field is passed to this function, it will not
// be modified, even though it is nominally passed by reference.
// A character string passed by reference will be modified. A
// variable (other than a character string or memo field) that
// is passed by reference will be unchanged (and the function return
// value will be the same value as the variable).
//
// Returns: encrypted string of same length as plaintext
//
// Author: Walter J. Kennamer
// History: Initially written August 19, 1991
//--------------------------------------------------------------------------
{
=== End Encrypt.Txt ===

Alexander

* Crossposted in RU.VISUAL.FOXPRO
* Crossposted in RU.FOXPRO


Valery Pavlenko

unread,
Feb 12, 1998, 3:00:00 AM2/12/98
to

Hi, Alexander

>кaк мoжнo зaшифpoвaть тeкcтoвyю cтpoкy в тaблицe,
дa eщe тaк чтoбы мoжнo былo
>ee пoтoм paзшифpoвaть :)
>

Проще всего с использованием побитной
операции исключающего ИЛИ (XOR).
Примерчик лови:
---- Резать-----------
cPassWord='Alexander' && Ключ
cTestString='12345678' && Строка
a=PassWord(cTestString,cPassWord)
?a
b=PassWord(a,cPassWord)
?b
*******************************

FUNCT PassWord
LPARAM lpCod,lpPassWord
LOCAL lpWord1, i
lpWord1=''
i=1
do while len(lpCod)<>0
i=iif(i>Len(lpPassWord),1,i)

lpWord1=lpWord1+chr(BITXOR(asc(Left(lpCod,1)),asc(subs(lpPassWord,i,1))))
lpCod=Right(lpCod,Len(lpCod)-1)
i=i+1
endd
RETURN lpWord1
----Конец---------

Успехов

0 new messages