All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jruby.util.PerlHash Maven / Gradle / Ivy

There is a newer version: 9.4.9.0
Show newest version
package org.jruby.util;

/**
 * Perl's Hash implementation.
 *
 * @author [email protected]
 */
public class PerlHash {
    public static long hash(long key, byte[] src, int offset, int length) {
	for (int idx = 0; idx < length; ++idx) {
	    key += (src[offset + idx] & 0xFF);
	    key += (key << 10);
	    key ^= (key >>> 6);
	}
	key += (key << 3);
	key ^= (key >>> 11);
	key += (key << 15);
	return key;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy