From 1b41f051d8d55fa9bd9a41429cd499cf66f21a8e Mon Sep 17 00:00:00 2001 From: padams Date: Sat, 7 Jan 2012 03:51:05 +0000 Subject: [PATCH] adding support for 64bit hash Id creation --- owa_lib.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/owa_lib.php b/owa_lib.php index 98afe2f01..75be78824 100644 --- a/owa_lib.php +++ b/owa_lib.php @@ -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 ) ); + } + } } /**