Skip to content

Commit

Permalink
adding support for 64bit hash Id creation
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Jan 7, 2012
1 parent 7e84dbd commit 1b41f05
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions owa_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,18 @@ public static function displayView($data, $params = array()) {
* @access private
*/
public static function setStringGuid($string) {
if (!empty($string)):
return crc32(strtolower($string));
else:
return;
endif;

if ( $string ) {


if ( owa_coreAPI::getSetting('base', 'use_64bit_hash') && PHP_INT_MAX == '9223372036854775807') {
// make 64 bit ID from partial sha1
return (string) (int) hexdec( substr( sha1( strtolower( $string ) ), 0, 16 ) );
} else {
// make 32 bit ID from crc32
return crc32( strtolower( $string ) );
}
}
}

/**
Expand Down

0 comments on commit 1b41f05

Please sign in to comment.