TGC Codebase Backup



Hidden Password Entry by madmaz

6th Sep 2011 11:32
Summary

A password entry function that converts your password into a single caracter.



Description

I was looking for some code like this in the database but found none. What I did find was a lot of password security. This actualy makes it feel like you are inputing a real password since it changes your text into any hash you wish.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    remstart

Funtion Password Text

This function converts the Password$ string into a Hash of single caracters.
This works in real time if you are updating the screen and works best if used with the Entry$(1) command
This Function is also placeble in any place on the screen and also it has a built in deletion.
It returns the hashed version of the string since you don't need it to return the actual password as it is
a function argument

remend

Do
cls

pass$ = entry$(1)
text 0,0,"Password:"
text 0,16,"Typed:" + pass$
password_text(text width("Password:"),0,"*",pass$)



Loop

function password_text(x,y,hash$,password$)



pass_size = len(password$)
hash_size = len(hashed$)


if hash_size < pass_size
    for f = 1 to pass_size
        hashed$ = hashed$ + hash$
    NEXT f
endif
if pass_size < hash_size
    hashed$ = left$(hashed$,len(input$))
ENDIF

text x,y,hashed$

ENDFUNCTION hashed$

ENDFUNCTION hashed$