Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default [PHP] Neat Little Hashing Function

    Here's a little function I wrote for use in one of my projects:

    PHP Code:
    function Protect($string$salt "FGTERTYBE5434576876897RETBREY"){
    $string str_rot13(hash("whirlpool"$salt str_rot13($string)));
    Return 
    $string


    Usage:

    Hashing with the default salt:
    PHP Code:
    Protect("PAssw0rd"); 
    Hashing with a custom salt:
    PHP Code:
    Protect("PassW0rd""MYsA1t"); 
    Enjoy.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  2. #2
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    I really don't see why you posted this..? You just usedstr_rot13 and the hash function withwhirlpool.. you didn't write the hashing, you just wrote a function to call it..

  3. #3
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    I really don't see why you posted this..? You just usedstr_rot13 and the hash function withwhirlpool.. you didn't write the hashing, you just wrote a function to call it..
    Which is less time consuming:

    PHP Code:
    $string=str_rot13(hash("whirlpool""My Salt Here" .str_rot13("My Password"))); 
    OR:

    PHP Code:
    $String Protect("My Password""My Salt Here"); 


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Which is pointless? Yours. Why are you shifting the characters any way? Anyone who knows that they are shifted will be able to just reverse the shifting and it's back to being pointless.

    I suggest you take a few minutes to read up on encryption and hashing algorithms and learn a tad bit before showing off things that are pointless.

  5. #5
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    Which is pointless? Yours. Why are you shifting the characters any way? Anyone who knows that they are shifted will be able to just reverse the shifting and it's back to being pointless.

    I suggest you take a few minutes to read up on encryption and hashing algorithms and learn a tad bit before showing off things that are pointless.
    By your reasoning, you might as well store passwords in plain text. Sure, if you knew you it was shifted you can reverse it for the second shift, but not for the first shift.
    Last edited by triston220; 04-12-2011 at 06:44 PM.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  6. #6
    Join Date
    Jul 2004
    Location
    California
    Posts
    8,725
    Tokens
    3,789
    Habbo
    HotelUser

    Latest Awards:

    Default

    [@]@triston220[/@] It's good to see you're investing time in securing your scripts, I take it you're still learning and that's fine. If you want to protect user passwords further you could look into adding a salt, or reading up on encrypting and hashing (stackoverflow is usually a good place to see how other folks secure data, something like this http://stackoverflow.com/questions/3...a256-or-sha512) good luck

    I'd also pay no attention to how dentafrice worded his post. He means well I'm sure, I think he probably just doesn't realize that the way he worded his post sounds slightly rude/arrogant.
    I'm not crazy, ask my toaster.

  7. #7
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    Quote Originally Posted by HotelUser View Post
    [@]@triston220[/@] It's good to see you're investing time in securing your scripts, I take it you're still learning and that's fine. If you want to protect user passwords further you could look into adding a salt, or reading up on encrypting and hashing (stackoverflow is usually a good place to see how other folks secure data, something like this http://stackoverflow.com/questions/3...a256-or-sha512) good luck

    I'd also pay no attention to how dentafrice worded his post. He means well I'm sure, I think he probably just doesn't realize that the way he worded his post sounds slightly rude/arrogant.
    Thanks. The script does use a salt though. Encryption is defiantly a viable option though.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  8. #8
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Of course I mean well.

    Anyways, the rotation is pointless and stupid. Trust me. You're using whirlpool and a salt, that's good enough. If someone gets access to your database, in most cases they will most likely already or in the future have access to your files and program code.

    Meaning:

    1) They have found a vulnerability in your site, have access to your files and read a configuration file to find MySQL details and then dump your database.

    2) They have FTP and are using it maliciously to now read your configuration file and dump your database.

    3) They have found exploits and now have access to your database and may or may not eventually get your files.

    So either way, the algorithm in your program's code of shifting the string is pointless.. stick with a GOOD user-variable'd salt and a good hashingalgorithmand that's all you need.

    It's obvious you're just young and learning, and do not really know a lot about PHP, encryption, hashing, or security. That's fine. But take my word for it when I tell you things... I've been there, done that, too many times in my near decade of programming.

  9. #9
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    Of course I mean well.

    Anyways, the rotation is pointless and stupid. Trust me. You're using whirlpool and a salt, that's good enough. If someone gets access to your database, in most cases they will most likely already or in the future have access to your files and program code.

    Meaning:

    1) They have found a vulnerability in your site, have access to your files and read a configuration file to find MySQL details and then dump your database.

    2) They have FTP and are using it maliciously to now read your configuration file and dump your database.

    3) They have found exploits and now have access to your database and may or may not eventually get your files.

    So either way, the algorithm in your program's code of shifting the string is pointless.. stick with a GOOD user-variable'd salt and a good hashingalgorithmand that's all you need.

    It's obvious you're just young and learning, and do not really know a lot about PHP, encryption, hashing, or security. That's fine. But take my word for it when I tell you things... I've been there, done that, too many times in my near decade of programming.
    SQLi = Access to database.
    Shelling = Access to files, and therefore the database too.

    It all depends on the exploit used. If it's been SQL injected, (Which, hopefully it won't have been, if you sanitize your input) an intruder wouldn't know it's been rotated. This would delay, or fully prevent, reversal of the original input.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  10. #10
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    It would delay. Rotational patterns have always been found and identified. Since the earliest of caesarciphers. Might as well give up, not going to win, kid.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •