May 29, 2006 § 7 Comments
My class “SecurePassword” has been approved at phpclasses.org and it gave me the chance to be one of the top ten authors authors once again.
See and download this class:
About this class:
This technique of generating password hash (or password digest) generates strong hash of plain
text password. And for authentication, it matches a generated hash with a plain password.
Modern computers can generate both md5() and sha1() very quickly, thousands per seconds. Thus generating hashes and matching with existing hashes (for hacking) is easy. The present technique implements a kind of hashing that makes strong salt, decodes that and makes hash with that decoded salt and the given password. It gives a variable length strong hash that makes attackers’ job tough.
This technique –
1. Creates strong salt of given length
2. Makes that salt more strong by decoding it to binary data
3. Creates hash appending that salt to the output of secure hash algorithm – 1
(sha1)generated hash. Parameter of SHA1 in this case is (decoded salt + plainpassword)
4. In matching a password with a stored hash,
(i) The salt is extracted from given/stored hash and decoded first
(ii) Then sha1() is implemented on that salt + plain password
(iii) Then this hash is compared with the sha1() generated-hash portion of given/stored hash
1. If no parameter is given, initSalt() generates random salt that eventually generates random password hash for the same plain password.
2. When password characters are only plaintext, attackers’ job is easy. Use of base64_decode()
helps this technique generate more strong password since the hash contains binary data.
3. Changing the length of salt (saltLength), you can generate password of variable lengths(upto 70 characters). This strengthens the password and makes attackers’ job tough.
Please rate this class if you like and if it comes to your needs. Please feel free to contact me for
any suggestion and/or further assistance regarding the technique and its implementation.
May 16, 2006 § 2 Comments
Session ID hijacking can be a problem with PHP Websites. The PHP session tracking component uses a unique ID for each user’s session, but if this ID is known to another user, that person can hijack the user’s session and see information that should be confidential. Session ID hijacking cannot completely be prevented; you should know the risks so you can mitigate them.
A user who creates a new session by logging in should be assigned a fresh session ID using the session_regenerate_id() function. A hijacking user will try to set his session ID prior to login; this can be prevented if you regenerate the ID at login.
** Source : sitepoint.com
May 13, 2006 § Leave a comment
Get your pinging result by PHP like this way:
I got this result:
 => PING http://www.l.google.com (220.127.116.11) 56(84) bytes of data.
 => 64 bytes from 18.104.22.168: icmp_seq=0 ttl=245 time=608 ms
 => 64 bytes from 22.214.171.124: icmp_seq=1 ttl=245 time=519 ms
 => — http://www.l.google.com ping statistics —
 => 2 packets transmitted, 2 received, 0% packet loss, time 2755ms
 => rtt min/avg/max/mdev = 519.180/563.682/608.185/44.508 ms, pipe 2
Someones asked me this type of questions( related to checking connectivity by PHP). This one is my solution for now.
May 11, 2006 § Leave a comment
Today’s google “Quote of the Day” reads –
“All truth passes through three stages. First, it is ridiculed. Second, it is violently opposed. Third, it is accepted as being self-evident.”
I recall this type of memory. When I first started phpResource, some so called PHP geeks started to oppose it. Then they tried to strongly oppose it. But they failed, and they will fail. But what I got from this is some so called geeks’ behaviour. I always respected them, but they disclosed their nature(I never thought such about them). But finally phpResource is going ahead strongly proving its strength enough to go forward.
phpResource, Go AHEAD Strongly !!
May 11, 2006 § Leave a comment
When Code is Poetry, Life is . . . . .
return her instanceof Error ? false : true;}}
a dysfunctional relationship… :p
I got it from http://www.codingforums.com while searching the netWorld.
Visit this link for more code poetries:
Enjoy Coding !!
May 9, 2006 § Leave a comment
Writting both simple and complex smarty plugins are very easy. It helps you simplify your smarty use. So why not using your own plugins? For a short guideline, follow this link:
Keep going on !!
May 8, 2006 § Leave a comment
Why should we always put our html-code (that contains smarty tags) to a temporary file for smarty use ? It can be done without doing so. This is important in the case of executing templates that come from DB, LDAP, etc. See this link to know details:
Hope you will enjoy !!