Jump to content

anson5

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

anson5's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. There are two reasons for storing hash in binary format: [*]It saves half the storage size, for a 160-bit hash, it's BINARY(20) vs CHAR(40) [*]Operations on BINARY is faster according to benchmarks So my question will be which one will be faster: [*]mysqli->real_escape_string() on a 20 byte binary string (note that I used hash($algo, $passwd, true) to output raw binary data), or [*]telling hash() to output hexadecimal character string (conversion from binary needed) plus UNHEX on MySQL?
  2. I'm planning on storing RIPEMD-160 passphrase hash's raw binary data in MySQL as BINARY(20). Right now, I'm not sure if one of the following INSERT approach is more preferrable and more efficient: Approach (1) - Using mysqli::real_escape_string() ================================================= $binhash = $mysqli->real_escape_string(hash('ripemd160', $passphrase, true)); $mysqli->query("INSERT INTO testtbl (Passphrase) VALUES ('" . $binhash . "')"); This approach saves hash() from converting raw binary data to hexadecimal format, but need to process and escape the binary string. Approach (2) - Using UNHEX() on MySQL ===================================== $hexhash = hash('ripemd160', $passphrase); $mysqli->query("INSERT INTO testtbl (Passphrase) values (UNHEX('" . $hexhash . "'))"); This approach needs hash() to convert binary data to hexadecimal but no need for escaping the string and it put extra load on MySQL to convert the hexadecimal back to binary.
  3. What is the difference between the hash algo "tiger192,3" and "tiger192,4"? I ran fsum/HashCalc to get a TIGER hash from a string and it is different with either "tiger192,3" or "tiger192,4". I also tried using the hash as hex string input to rehash 3 or 4 times, but still cannot get an equivalent to that of "tiger192,3" or "tiger192,4"...
  4. Initially I built PHP 5.3.6 with the following configure command: ./configure --cache-file=config.cache --prefix=$HOME/php-5.3.6 --with-config-file-path=$HOME/php-5.3.6/etc --with-openssl=$HOME/openssl --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --with-gd --with-mhash=$HOME/mhash --with-ldap --enable-mbstring --with-mcrypt=$HOME/libmcrypt --with-mysql-sock=$HOME/mariadb/tmp/mysql.sock --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --enable-sqlite-utf8 --with-tidy=$HOME/tidy --enable-zip --with-pear I used FastCGI on Lighttpd with php-cgi without a problem, but then I wanted Apache httpd to use mod_php as well, so I built libphp5.so with the above configure command plus the following option: --with-apxs2=$HOME/httpd/bin/apxs It worked fine with httpd but then php-cgi is gone and lighttpd cannot load it. I tried adding --enable-cgi in addition to --with-apxs2 in the configure command but still didn't get php-cgi. Can PHP be only built either for libphp5.so or php-cgi, but not both?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.