Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.