Activity Stream
48,167 MEMBERS
62383 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 10 of 42

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    (1only)
    Website's:
    BarakaDesigns.com Amodity.com IMGFlare.com
    PHP Code: 
        public function saltGenerator($limitChars=8) {
            
    $symb "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+[]{}\\|;:'\",./<>?~`";//letters,numbers,& symbols
            
    $saltv '';
            for (
    $i 0$i $limitChars$i++)
                
    $saltv .= $symb[rand(0strlen($symb) - 1)];
            return 
    $saltv;
        } 
    well this is pretty small but its a mini function to generate salt hash value(s) to make secure when inserted in the database for either when a user registers or w/e which then when you want use of the function for making the pass-hash you can do something like this:
    PHP Code: 
    $saltv $saltv ?: $this->saltGenerator();
    $phash md5(md5($saltv) . md5($pass));
    $sql->password $phash;
    $sql->salt $saltv
    This is really something that can be used in a class to make things easier. Did this off the top of my head so if there is room for improvement let me know
    Baraka Reviewed by Baraka on . Snippet of the Day Disclaimer: Ok, just an idea I thought up. Might take off, might not. With that out of the way let me introduce snippet of the day. In this thread you may post one snippet of code a day (at most) that you are particularly proud of. Rules: Snippets must be at most 15 lines long. Try to keep them as short as possible. You must have written them yourself and within the course of the day. Any language is allowed No insulting peoples coding. Although that said, if you just started Rating: 5

    CEO Of BarakaDesigns.com, Need PSD to vB? Need a Custom skin? Hit me up -Baraka aka 1Only

  2.   Sponsored Links

  3.     
    #2
    Respected Developer
    Website's:
    X4B.org
    Quote Originally Posted by 1only View Post

    well this is pretty small but its a mini function to generate salt hash value(s) to make secure when inserted in the database for either when a user registers or w/e which then when you want use of the function for making the pass-hash you can do something like this:

    This is really something that can be used in a class to make things easier. Did this off the top of my head so if there is room for improvement let me know
    Ask and ye shall receive.
    PHP Code: 
    function saltGenerator($limitChars=8) {
        
    $saltv '';
        for (; 
    $limitChars; --$limitChars)
            
    $saltv .= chr(rand(33,126));
        return 
    $saltv;

    Best I can think of, also includes a few more symbols in the calculation, see ascii table: http://www.asciitable.com/index/asciifull.gif

  4.     
    #3
    (1only)
    Website's:
    BarakaDesigns.com Amodity.com IMGFlare.com
    Quote Originally Posted by SplitIce View Post
    Ask and ye shall receive.
    PHP Code: 
    function saltGenerator($limitChars=8) {
        
    $saltv '';
        for (; 
    $limitChars; --$limitChars)
            
    $saltv .= chr(rand(33,126));
        return 
    $saltv;

    Best I can think of, also includes a few more symbols in the calculation, see ascii table: http://www.asciitable.com/index/asciifull.gif
    thanks for that, makes the function more usable

    CEO Of BarakaDesigns.com, Need PSD to vB? Need a Custom skin? Hit me up -Baraka aka 1Only

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Plz Help To Add A Php Snippet Into My DLE Index !
    By JoomlaZ in forum Web Development Area
    Replies: 0
    Last Post: 7th Jul 2011, 01:18 PM
  2. [C#] Tiny Web Server (snippet)
    By Hyperz in forum Web Development Area
    Replies: 6
    Last Post: 24th Jun 2010, 01:19 PM
  3. Image Upload in php. Code snippet #2
    By SplitIce in forum Tutorials and Guides
    Replies: 5
    Last Post: 31st Oct 2009, 07:40 AM
  4. See real OOP (Snippet from Litewarez V2) Webmasters CP
    By litewarez in forum Tutorials and Guides
    Replies: 21
    Last Post: 19th Sep 2009, 03:59 PM
  5. A Snippet from my latest project
    By litewarez in forum Tutorials and Guides
    Replies: 19
    Last Post: 21st Jun 2009, 05:17 PM

Tags for this Thread

BE SOCIAL