Hi folks. Well, seeing as it's December 3rd (for a whole 18 minutes more in my timezone :P) I figured I'd better go ahead and release something. You know, coz it's December 3rd. International You May As Well Go Ahead And Release Something Day.
On somewhat of a whim (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44902.0) I figured I'd see if I could mask the text in an AGS TextBox without utterly obliterating the existing text. From there I got a bit more ambitious, and after several hours trying to convert a rather simple C++ MD5 algorithm (http://www.zedwood.com/article/121/cpp-md5-function) into AGS code (http://img337.imageshack.us/img337/8733/unexpected.png), I decided to postpone the hashing portion of the module for now and just get some feedback on what I've done so far.
What I've done so far is this.
- Created a struct called Password. You can create instances (as many as you want!) of this struct. Of course, unless they're linked to a TextBox control they're not really doing much for you.
Password password;
- As soon as the control has been linked to an instance of the password struct, its text immediately becomes masked. All further input to the TextBox will also be masked.
- You can specify an alternate character to mask the password (other than an asterisk) via Password.MaskChar.
password.MaskChar = '~';
This will make every character in the TextBox appear as a tilde instead of an asterisk.
- At any time if you want to unmask a TextBox, this can be done by simply setting Password.Control to null.
password.Control = null;
I'll continue trying to figure out why my MD5 hashes are coming out as something utterly different to MD5 hashes, but I thought I'd go ahead and get this out there to see what people think.
Practical Usage Examples:- In-game password masking.
- Password-protected save games (ask me how! :=)
- Obfuscating the name of your players' save games, to make them really upset! 8)
- Take over the world!
- Something else!
Download (http://meleepta.x10host.com/Password.rar)P.S. Sometimes BBCode can be a pain in the neck!
Amazing job as always!
I like finding ways of circumnavigating the whole "no pointers to custom structs" issue, because seriously they would have been useful here. But I think I managed to get by pretty good thanks to the fact that there's a limited number of TextBox controls in the game at any given time anyway (which allowed me to create a managed set of IDs for the struct instances you're creating without you having to call a silly Init function).
I have noticed that there's a very slight delay between the actual keyboard input and when the module is intercepting it, so the characters may flash on-screen (very, very, very briefly), but given that it would only be the exact character the player is typing at that moment, and it's only visible for a fraction of a second, I'd say it's negligible. I doubt password security is a top priority for AGS games. ::)
Hopefully someone will actually find this useful. In any case, it was a fun little technical experiment on several fronts. :D
Hmm, good job indeed. I get a very brief flash, but that disappears as soon as I use windowed mode. Thumbs up.
The Link is dead.
The link has been updated. Host removed the "ing" suffix from the main domain my site is hosted under (although they still own both domains).