Board index » delphi » Password encryption and storing...

Password encryption and storing...

Hi!

My problem is that I want to protect my program with password (i.e.
I execute program and it asks me to enter password.). Does any one can
suggest me any good encryption algorithms? Another problem is that I
need to store this password somewhere. It can be stored in file or in
exe file, but it can be changed or replaced. I could use checksum to see
if the password is not changed, but I don't know the methods how to
calculate it. If anyone have any ideas on how to solve these two
problems, please reply.

Thanks in advance,

Andrew Semov.

 

Re:Password encryption and storing...


Quote
Andrew Semov (an...@mailbox.riga.lv) wrote:

: My problem is that I want to protect my program with password (i.e.
: I execute program and it asks me to enter password.). Does any one can
: suggest me any good encryption algorithms? Another problem is that I
: need to store this password somewhere. It can be stored in file or in
: exe file, but it can be changed or replaced. I could use checksum to see
: if the password is not changed, but I don't know the methods how to
: calculate it. If anyone have any ideas on how to solve these two

      Maybe an easy way would be to _NOT_ have the
password defined by one word, but to have a number
of type character variables defined, and then put
them together for the password, like:

PWC2:= 'y';
PWC1:= 'e';
PWC3:= 'k';
Password:= PWC3 + PWC1 + PWC2;

      and these statements could be mixed in with
other initialization statements.
      The idea is to stop most people from being
able to use it, chances are someone can decrypt
anything, especially a distributed program.

Ken Fischer

---

Re:Password encryption and storing...


Hope this helps... the aurthor (from swag)

{
KEITH TYSINGER
You can make an encoder that will scramble a string(s) that even YOU, the
 programmer couldn't unscramble without a password. They are many different
 ways to scramble a string; just be creative! One way is to swap every
 character with another character ( ex. swap every letter 'A' with the
number
 '1') , a better way would use a password to scramble it. Here is a simple
 procedure that requires the password, the string to be scrammbled, and
returns
 the scrambled string. The password should not exceed 20 characters in
length.
Forget about the messy code}

Procedure encode(password, instring : string; var outstring : string);
var
  len,
  pcounter,
  scounter : byte;
begin
  len := length(password) div 2;
  scounter := 1;
  pcounter := 1;
  repeat
    outstring := outstring + chr(ord(password[pcounter]) +
                             ord(instring[scounter]) + len);
    inc(scounter);
    inc(pcounter);
    if pcounter > length(password) then
      pcounter := 1;
  until scounter > length(instring);
end;
procedure decode(password, instring : string; var outstring : string);
var
  len,
  pcounter,
  scounter : byte;
begin
  len := length(password) div 2;
  scounter := 1;
  pcounter := 1;
  repeat
    outstring := outstring + chr(ord(instring[scounter]) -
                             ord(password[pcounter]) - len);
    inc(scounter);
    inc(pcounter);
    if pcounter > length(password) then
      pcounter := 1;
  until scounter > length(instring);
end;
var
  password,
  original,
  scrambled,
  descrambled : string;
begin
  original := 'Hello There!';
  password := 'Eat my';
  encode(password, original, scrambled);
  writeln('orig = ', original);
  writeln('scrm = ', scrambled);
  decode(password, scrambled, descrambled);
  writeln('dcod = ', descrambled);
  readln;
end.

Quote
Andrew Semov wrote in message <35A8C398.14896...@mailbox.riga.lv>...
>Hi!

>My problem is that I want to protect my program with password (i.e.
>I execute program and it asks me to enter password.). Does any one can
>suggest me any good encryption algorithms? Another problem is that I
>need to store this password somewhere. It can be stored in file or in
>exe file, but it can be changed or replaced. I could use checksum to see
>if the password is not changed, but I don't know the methods how to
>calculate it. If anyone have any ideas on how to solve these two
>problems, please reply.

>Thanks in advance,

>Andrew Semov.

Re:Password encryption and storing...


Quote
Keith wrote in message <6ocf6p$...@examiner.concentric.net>...
>Hope this helps... the aurthor (from swag)

>{
>KEITH TYSINGER
>You can make an encoder that will scramble a string(s) that even YOU,
the
> programmer couldn't unscramble without a password. They are many
different
> ways to scramble a string; just be creative

How about getting the 32-bit CRC of the password? That should be
unscrambleable.

FP

Re:Password encryption and storing...


Andrew Semov heeft geschreven in bericht
<35A8C398.14896...@mailbox.riga.lv>...

Quote
>Hi!

>My problem is that I want to protect my program with password (i.e.
>I execute program and it asks me to enter password.). Does any one can
>suggest me any good encryption algorithms? Another problem is that I
>need to store this password somewhere. It can be stored in file or in
>exe file, but it can be changed or replaced. I could use checksum to see
>if the password is not changed, but I don't know the methods how to
>calculate it. If anyone have any ideas on how to solve these two
>problems, please reply.

Don't put the real password in your program. Encrypt the password, save that
in your program. Then encypt the input, see if it's the encrypte password.
Encryption can be simple:
XOR all characters with a value
XOR with the last char.
Quote
>Thanks in advance,

>Andrew Semov.

Other Threads