Welcome to the Browser-Base Game Zone forums!
function unique_token(){ $now = microtime(); $token = (hash('sha256',$now)+hash('sha256',$user));}
i am using php i'm going to use the start_session(); code and thus have $_Session['username'] stored
I can send you pics of my cocks if you want reference.
Quotei am using php i'm going to use the start_session(); code and thus have $_Session['username'] stored And that's it Everything else in your post is a useless fat. No paranoia, OK? There is one method to handle logins. There is no such thing as "best method to handle login" because there is only one method. And that is the method you described in the sentence above No half page post about such simple thing as login, please, please, please
A visitor accessing your web site is assigned a unique id, the so-called session id. This is either stored in a cookie on the user side or is propagated in the URL.
ok, and i'm one of the most paranoid people around... i look at every potential player as a truly gifted hacker, so thus i try to think of everything i need to do to attempt to thwart their attempts as best as i can. I've always been paranoid and
Yep, there is one and only one way of handling login, which is putting username/userid in session. The way session is stored is irrelevant (server can even carve the data in stone, it won't change even one line in the login script ).
Quote from: Chris on February 07, 2010, 06:14:08 AMYep, there is one and only one way of handling login, which is putting username/userid in session. The way session is stored is irrelevant (server can even carve the data in stone, it won't change even one line in the login script ).There is an important distinction here that should be emphasized, though: User name/id has to go in the stored server-side session data, not in the session cookie (or a session id in the URL). It's very easy for someone not used to working with that distinction to misread "there is one and only one way of handling login, which is putting username/userid in session" to mean that the username goes into the session cookie, which is absolutely wrong and utterly insecure.The session id, whether transmitted as a cookie or placed into your URLs, should be a random value with no way to derive any meaningful information from it directly. Its sole purpose is as a key which can be used by the server to look up stored session data in a database/file/cache/stone tablets and that stored data is where the username, access level, etc. belong.As a side point, going back to the initial post on this thread, basing your session ids on the time, even if you use a high-resolution timer, is generally considered bad practice because it makes it possible for a determined attacker to guess someone else's session id based on when they logged in and then hijack their session. Generate a random number, then md5 or sha hash it instead.
function create_token{$random = rand(1,100000); //i think this is the correct way to display this number here since commas are already reserved$token = hash('sha256',$random);}
Quote from: dsheroh on February 07, 2010, 07:58:07 AMAs a side point, going back to the initial post on this thread, basing your session ids on the time, even if you use a high-resolution timer, is generally considered bad practice because it makes it possible for a determined attacker to guess someone else's session id based on when they logged in and then hijack their session. Generate a random number, then md5 or sha hash it instead.so which would be a better function to use then.Code: [Select]function create_token{$random = rand(1,100000); //i think this is the correct way to display this number here since commas are already reserved$token = hash('sha256',$random);}or should i do something different such as using a random string of some length then hash that and use that as my $random?}
As a side point, going back to the initial post on this thread, basing your session ids on the time, even if you use a high-resolution timer, is generally considered bad practice because it makes it possible for a determined attacker to guess someone else's session id based on when they logged in and then hijack their session. Generate a random number, then md5 or sha hash it instead.
function unique_token(){ $random = mt_rand() + microtime(true); $token = hash('sha256',$random);}
function auth($username, $password){ $user::authWith($username, $password); if (!($user instanceof User)) //http redirect to bad login page session_regenerate_id(); $_SESSION['uid'] = $user->id; //http redirect to home page}
return sha1($random.'_my_kick_arse_salt');
Following the theme of paranoia are there any other viable options to md and sha seeing both *can* be brute forced. (clarification sha and sha-1)
Hey with cycling salts you need define your salt list once, otherwise how do you re-hash someones password? To hash it remember you need the original plain text password, unless your rehashing upon login, then its all good.
Could you not just do a simple salt+hash and like for example the BBG tutorial if the hash off simply redirect them to a change password page?
each minute that they would have required to crack a password with md5/sha becomes 70 days with bcrypt. What they could have learned in an hour now takes 11 and a half years.
Here is some food for thought, reading through some various crypto articles at work(yes i was that bored) The most common weakness for all sorts of hashing/encryption is of course the user. Now I did some research in bcrypt and dsh was correct you can slow down bcrypt to a crawling 7.7 hash tries a second which would take 10,000 times more time to crack then say sha1. A small but simple factor came to mind wondering through all these articles, why not simply create your own dictionary file like a would be cracker would use, I am more then certain you can find hundreds on the web, and using php and I am assuming Ajax to check each users password on account creation and password change against such list,Thus forcing users to not use dictionary based passwords. Or a more Simple route i would imagine to simply to require a minimum of say 6 Alpha based characters and 4 Numeric totaling in a minimum password length of 10, or I am sure the paranoia committee can come up with what they would be happy with for a minimum password standard Now running under the rule of " No System is Totally Secure" which is fact, the eliminating dictionary based attacks and the obvious SQL injection and so forth, and your huge list of ever changing salts. You would be seriously limiting any would be attacking shy of attacking the web host itself,lol