This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DaKillerBear1's profile picture

"New" way of storing usernames and passwords!

Started by DaKillerBear1, 10 July 2015 - 09:14 AM
DaKillerBear1 #1
Posted 10 July 2015 - 11:14 AM
Basicly I found a nifty way of storing usernames and passwords in tables, this in turn allows you to "connect" usernames and passwords, if you know what I mean. Basicly If you store a username as the key in an array and the password as the value of the key.

Just thought it would be nice to share that. :)/>

Pros:

- You can check if usernames exist (By seing if the key returns nil or not)
- It's easy to add, change or delete usernames and passwords ( Add: exampleTable["username"] = "password", Change: exampleTable["username"] = "newPassword", Delete: exampleTable["username"] = nil,

Please tell me if this is a good idea, and leave your thoughts below. If you want, I can post a simple password program I wrote.

Thanks! :)/>
Bomb Bloke #2
Posted 10 July 2015 - 11:33 AM
Well done for noticing it. There are a lot of tasks that're made very simple by using tables in creative ways. :)/>
DaKillerBear1 #3
Posted 10 July 2015 - 11:35 AM
Thanks! Hope it helps someone :)/>
TheOddByte #4
Posted 13 July 2015 - 12:44 AM
That's a good way to do it, tables make everything simpler, so instead of having a lot of variables you can cram them into a table, and manage them easier aswell.

If you want to expand your knowledge even further in security I'd suggest you'd check out hashing, encryption and encoding, that is if you save the user table into a file that you don't want other people to see.
Only one of those I suggested would be needed though, and that would be hashing, the other stuff would be more important for rednet and such.
This is only a suggestion though, as I thought you maybe wanted to challenge yourself with something new, if you don't know a lot about it already that is.