Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   desordenando (https://www.clubdelphi.com/foros/showthread.php?t=31659)

diniremix 13-05-2006 21:38:36

desordenando
 
hola a todo@s
despues d varios dias sin entrar aqui d nuevo.:D

tengo una duda ya c q existen los algoritmos de ordenacion y todo eso, pero y sip quiero "desordenar" un dato d tal modo q sea casi "ilegible o al menos dificil" de leer alguna idea?:o:rolleyes::cool:

gracias a todos los comentarios ;)
ah y sip saben d como les va con ETI hacerme saber en el correo;)

marcoszorrilla 13-05-2006 22:01:57

Supongo que quieres decir encriptar y no desordenar?

Aquí tienes un ejemplo sacado de Borland(de los muchos que puedes encontrar por ahí):



Encrypting and Decrypting strings in Delphi. - by Kendall Sullivan
Rating: Ratings: 4 Rate it
Abstract: Code sample demonstrates a basic Encryption/Decryption algorithm for strings.
QUESTION: How can I encrypt and decrypt string values?
ANSWER:
There are a number of ways to do this, below is a code sample that demonstrates one of the ways. Start with a form, and drop three Edit components, and two buttons. Add the EnDeCrypt function to the TForm1 class declaration in the type portion of the Unit. Omitting the TForm. section of the declaration. Then add the function in the implementation section of the Unit as shown below. Now double click each of the buttons and add the code as shown below. Run the project, in the Edit1 text area type in a word and click Button1. Now click Button2, you should see your word encrypted in Edit2 text and decrypted in Edit3 text. This should give you a basic idea on how Encryption works.

Código Delphi [-]
type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Button2: TButton;
    Edit3: TEdit;
    procedure Button1Click(Sender: TObject);
    function EnDeCrypt(const Value : String) : String;
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.EnDeCrypt(const Value : String) : String;
var
  CharIndex : integer;
begin
  Result := Value;
  for CharIndex := 1 to Length(Value) do
    Result[CharIndex] := chr(not(ord(Value[CharIndex])));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit2.Text := EnDeCrypt(Edit1.Text);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Edit3.Text := EnDeCrypt(Edit2.Text);
end;

Un Saludo.

diniremix 15-05-2006 18:13:46

hola y gracias por la respuesta la verdad era "desordenar" y no "encriptar" pero m gustaron las lineas:D
interesantes;)
gracias de nuevo bytes!!


La franja horaria es GMT +2. Ahora son las 11:40:35.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi