src/snac/server/authentication/APIKeyGenerator.php
/**
     * Generate API Key
     *
     * This method generates an API key by sampling random bytes, combined with the
     * time and userID to produce a unique string that is then hashed and base64-encoded
     * to produce a unique key.  This is essentially a long password and should NOT be stored
     * locally.
     *
     * @param int $userid The user's id
     * @return string The generated API key
     */
Generate API Key
This method generates an API key by sampling random bytes, combined with the
time and userID to produce a unique string that is then hashed and base64-encoded
to produce a unique key.  This is essentially a long password and should NOT be stored
locally.

@param int $userid The user's id
@return string The generated API key
Generate API Key This method generates an API key by sampling random bytes combined with the time and userID to produce a unique string that is then hashed and base64 - encoded to produce a unique key . This is essentially a long password and should NOT be stored locally . @param int $userid The user ' s id @return string The generated API key
public static function generateKey($userid) {
        $random = random_bytes(1024);
        $time = time();
        $seed = $random . $time . $userid;
        $inter = sha1($seed);
        $real = substr(base64_encode($inter), 0, -2);
        return $real;
    }
public static function generateKey ( $ userid ) { $ random = random_bytes ( 1024 ) ; $ time = time ( ) ; $ seed = $ random . $ time . $ userid ; $ inter = sha1 ( $ seed ) ; $ real = substr ( base64_encode ( $ inter ) , 0 , - 2 ) ; return $ real ; }
Generate API Key
 This method generates an API key by sampling random bytes, combined with the
 time and userID to produce a unique string that is then hashed and base64-encoded
 to produce a unique key.
Generate API Key This method generates an API key by sampling random bytes combined with the time and userID to produce a unique string that is then hashed and base64 - encoded to produce a unique key .