Board index » delphi » Help with enycription??
Ardener
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Ardener
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Help with enycription??
How do i do it?
im using T.Pascal 7 (Dos ver) i need to store the password in a record in a file and make it so that it I don't know where to start :-( Thanx in advance |
Klaus
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??QuoteArdener wrote in message <8civ2m$qt...@plutonium.btinternet.com>... You might use the trusty old "exclusive or" trick: for i := 1 to length(password) do password[i] := chr(ord(password[i]) xor where key is a number between 1 and 255. It has two advantages: It's very simple, and the decoding process is KlausL |
Frederic Bonro
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??QuoteArdener wrote: because no complicated decryption algorithm is required to transform an encrypted string back to its unencrypted form. First, you must choose a key. That will be typically be a series of encrypted := decrypted xor key where "encrypted", "decrypted" and "key" are of type char. You will have to encrypted := char(byte(decrypted) xor byte(key)) It's not elegant, I know. As mentioned above, a handy feature of decrypted := encrypted xor key. To encrypt or decrypt a string, xor each character of the string with the key |
Sebastian Koppeh
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??Hi, on Thu, 06 Apr 2000 at 21:20:35 o'clock, Ardener wrote: Quote> i need to store the password in a record in a file and make it so that it a college project) that security is *not* critical; in other words, it doesn't matter if someone manages to break the code. In this case a simple algorithm will suffice. One of the most simple algorithms is to shift every letter by a fixed Ng gur raq bs "Gvgnavp", gur fuvc fvaxf. Most newsreaders have a "Rot13" button that will make the text legible. To implement such an algorithm in Pascal, you have to get a numerical Write('> '); A Rot13 implementation can be found in Timo Salmi's faqpas6.txt. 19 5 13 6 1 ... In this case, the first letter is shifted by 19, the second by 5, and Please note that these algorithms do not offer security against - Sebastian |
Heinric
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??QuoteArdener wrote in message <8civ2m$qt...@plutonium.btinternet.com>... But here is a veiw ideas on the incryption: Firstly you should know that the string is an array so to get charachter n of the password you would use: password[n] Ok : Onother and maybe better way is to get the ascii code "ord" of the Chaou Check my web-site: |
Ardene
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??Ta for help |
Clif Pen
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??On Thu, 6 Apr 2000 22:20:35 +0100, "Ardener" <arde...@btinternet.com> wrote: Quote>How do i do it? undesired control chars. Works fine for a file of bytes or untyped file. Here there is no char < Chr(32). Program Encryption; CONST TYPE arry = Array[1..max] of Byte; Procedure SwapByte(VAR a, b:Byte); Procedure ShuffleArray(len:Byte; VAR aa:arry); For ct := 1 to 3 * len Do {shuffle, 3* is arbitrary, but works Procedure Cypher(x:s80; VAR z:s80; aa:arry; op:Integer); VAR j, k:Byte; BEGIN ShuffleArray(len, A); (************ END CODING BEGIN DECODING ******************) For ct := 1 to max Do A[ct] := 0; {reset variables} Writeln; Writeln('CODED TO ORIGINAL':40); ShuffleArray(len,A); Quote |
Clif Pen
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Help with enycription??On Thu, 6 Apr 2000 22:20:35 +0100, "Ardener" <arde...@btinternet.com> wrote: Quote>How do i do it? undesired control chars. Works fine for a file of bytes or untyped file. Here there is no char < Chr(32). Program Encryption; CONST TYPE arry = Array[1..max] of Byte; Procedure SwapByte(VAR a, b:Byte); Procedure ShuffleArray(len:Byte; VAR aa:arry); For ct := 1 to 3 * len Do {shuffle, 3* is arbitrary, but works Procedure Cypher(x:s80; VAR z:s80; aa:arry; op:Integer); VAR j, k:Byte; BEGIN ShuffleArray(len, A); (************ END CODING BEGIN DECODING ******************) For ct := 1 to max Do A[ct] := 0; {reset variables} Writeln; Writeln('CODED TO ORIGINAL':40); ShuffleArray(len,A); |
1. HELP HELP HELP HELP HELP HELP HELP HELP
2. HELP ME HELP ME HELP ME HELP ME HELP ME HELP ME
3. Help Help Help Help Help Help
4. ISDN & MODEM HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP
5. HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP............
6. Lousy Palette - help, help, help, help, help...