I don't know if anybody is interested, but just for the record...
I recently implemented an Oracle function which produces an equivalent
value to String>>hash using the algorithm described in
VMLibrary>>hashBytes:count:
So far it proved to work.
Code is below.
Best regards,
-- This code is intended to be placed inside of a PACKAGE BODY
-- but will work if 'CREATE OR REPLACE' is placed before FUNCTION
-- bitand and bitor are defined because oracle doesn't include them
-- for numbers out of the box (shame on them)
FUNCTION bitor(x IN NUMBER, y IN NUMBER) RETURN NUMBER IS
BEGIN
RETURN x + y - bitand(x, y);
END;
FUNCTION bitxor(x IN NUMBER, y IN NUMBER) RETURN NUMBER IS
BEGIN
RETURN bitor(x, y) - bitand(x, y);
END;
FUNCTION dolphin_hash(string IN VARCHAR2) RETURN NUMBER
IS
hashValue NUMBER;
BEGIN
hashValue := 0;
IF LENGTH(string) > 0 THEN
FOR idx IN 1..LENGTH(string) LOOP
hashValue := (hashValue * Power(2, 4)) + ASCII(SUBSTR(string, idx,1));
IF hashValue > 234579711 THEN
hashValue := bitxor(
bitand(hashValue,TO_NUMBER('FFFFFFF','XXXXXXXX'))
, bitand(floor(hashValue * Power(2, -24)), 240));
END IF;
END LOOP;
END IF;
RETURN hashValue;
END dolphin_hash;