help!! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help!!

hi everyone...
i am in grade 11 at a college in australia and i was wondering if i could get a little help with an assignment i am having trouble with..

what i need to know is:

what is the appropriate coding to put password security on a program i am making? the password for the program needs to be 6 chaacters (numbers only) long and the user has three attempts access the program with the correct code before it terminates.

i would be sooo grateful if you could help me with this..

Thankyou very much!
-Natalia









Comments

  • zibadianzibadian Posts: 6,349Member
    : hi everyone...
    : i am in grade 11 at a college in australia and i was wondering if i could get a little help with an assignment i am having trouble with..
    :
    : what i need to know is:
    :
    : what is the appropriate coding to put password security on a program i am making? the password for the program needs to be 6 chaacters (numbers only) long and the user has three attempts access the program with the correct code before it terminates.
    :
    : i would be sooo grateful if you could help me with this..
    :
    : Thankyou very much!
    : -Natalia
    :
    See the main Delphi board for the answer to this question.
  • cikumiyucikumiyu Posts: 12Member
    Here are the functions that demonstrate routines for encryption and decryption strings was wrote by Helmut Dollinger. It's only a simple way how to encrypt your password.

    [code]
    const
    C1 = 52845;
    C2 = 22719;

    function encrypt(const S: String; Key: Word): String;
    var
    I: byte;
    begin
    Result[0] := S[0];
    for I := 1 to Length(S) do begin
    Result[I] := char(byte(S[I]) xor (Key shr 8));
    Key := (byte(Result[I]) + Key) * C1 + C2;
    end;
    end;

    function Decrypt(const S: String; Key: Word): String;
    var
    I: byte;
    begin
    Result[0] := S[0];
    for I := 1 to Length(S) do begin
    Result[I] := char(byte(S[I]) xor (Key shr 8));
    Key := (byte(S[I]) + Key) * C1 + C2;
    end;
    end;
    [/code]
Sign In or Register to comment.