Computer Science Canada

masking passwords

Author:  Andy [ Sun Jan 25, 2004 5:25 pm ]
Post subject:  masking passwords

i saw danshadow's forum thingny and noticed he didnt mask the passwords so i made this

code:
fcn getpass : string
    var pass := ""
    var charc : string (1)
    loop
        getch (charc)
        exit when ord (charc) = 10
        if ord (charc) = 8 and length (pass) not= 0 then
            locate (whatrow, whatcol - 1)
            put " " ..
            locate (whatrow, whatcol - 1)
            pass := pass (1 .. length (pass) - 1)
        elsif ord (charc) not= 8 then
            pass := pass + charc
            put "*" ..
        end if
    end loop
    put ""
    result pass
end getpass

put getpass

Author:  shorthair [ Sun Jan 25, 2004 5:40 pm ]
Post subject: 

I like that , its well done , im gonna use that in my app

Author:  Mazer [ Sun Jan 25, 2004 7:16 pm ]
Post subject: 

Why not use setscreen ("noecho") and avoid all that locate nonsense?

Author:  McKenzie [ Sun Jan 25, 2004 8:06 pm ]
Post subject: 

because the user needs feedback to know that the key was accepted, especially with a wonky kb. Oh in VB just set the passwordChar property to * in your edit box (I'm not kidding)

Author:  shorthair [ Sun Jan 25, 2004 9:24 pm ]
Post subject: 

does hte * represent anything , like in turing ?

Author:  Dan [ Sun Jan 25, 2004 10:35 pm ]
Post subject: 

McKenzie wrote:
because the user needs feedback to know that the key was accepted, especially with a wonky kb. Oh in VB just set the passwordChar property to * in your edit box (I'm not kidding)


well the linux poleop have allways bivled that u should not even give out how long the pass is or at least that why i think they make there log in consloe that way Rolling Eyes

Author:  McKenzie [ Sun Jan 25, 2004 10:53 pm ]
Post subject: 

For the passwordChar all the * means is that when the user types replace it with a *. You don't actually set it in the code. You just change it in the properties box. You can use any character but * is the most common.

Author:  shorthair [ Sun Jan 25, 2004 10:57 pm ]
Post subject: 

Thanks for clearing that up for me guys , you had me confused for a while Very Happy

Author:  Mazer [ Mon Jan 26, 2004 10:30 am ]
Post subject: 

McKenzie wrote:
because the user needs feedback to know that the key was accepted, especially with a wonky kb. Oh in VB just set the passwordChar property to * in your edit box (I'm not kidding)

I know they need feedback. I'm saying, use noecho so that whatever they type doesn't show up, and whenever they press a key (except backspace and enter), put a * at the location. That's how I did the login for my game, the only difference is that I was using Font.Draw instead of put.

Author:  McKenzie [ Mon Jan 26, 2004 10:38 am ]
Post subject: 

I'm stupid, you're right Embarassed

Author:  Andy [ Mon Jan 26, 2004 11:12 am ]
Post subject: 

but there is not much difference... at least i dont think there is

Author:  jonos [ Mon Jan 26, 2004 11:20 am ]
Post subject: 

i tried making something like that, i couldn't though, that's cool.


: