zjrJS.Doc.hashCode() - zjrJS Javascript Library

This information lives on a webpage hosted at the following web address: 'https://www.omegajunior.net/code/zjrjs/'.

How to use zjrJS.Doc.hashCode(anyString).

A word from a sponsor:

zjrJS.Doc.hashCode(String anyString);

To quickly convert any string into a hash. Based on Java's String.hashCode() via the work found here: http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/

Typical usage
Create a small identificating checksum for any string, no matter how long. The resulting hash is an integer number, save for storing in memory and databases. Not to be used for encryption. The algorithm creates a one-way hash, meaning its result cannot be converted back into its input.

Member Type

Value Type
Integer Number.

String anyString: anything valid as a String in javascript will do.

zjrJS as of version 20141202t2322.

<script type="text/javascript" src="zjrJS.version.js" id="zjrJS"></script>
<script type="text/javascript">/* <![CDATA[ */
var storeKey = 'filterChoice?url=' + zjrJS.Doc.hashCode(window.location),
newStoreValue = 'technology=javascript;
zjrJS.Doc.Store.set(storeKey, newStoreValue);
/* ]]> */</script>

We use this ourselves in web pages that use our zjrFacetEngine.


Download zjrJS’ latest stable build (20141202t2322) minified (7.1KB).

Download zjrJS’ latest stable build (20141202t2322) (11.9KB).

Clicky Analytics