v0-hash.js
function vsHash(text) {
    let codes = [];
    let pos = 0;
    let partPos = 0;
    for (let i = 0; i < text.length; i++) {
        if (!codes[pos]) codes[pos]=[];
        let code = decodeCharCode2Int36(text.charCodeAt(i));
        if (code !== null) {
            codes[pos][partPos] = code;
            partPos += 1;
        }
        if (partPos === LEN) {
            partPos = 0;
            pos += 1;
        }
    }

    if (partPos) {
        for (let i = 0; i < LEN - partPos; i++) {
            codes[pos].push(0);
        }
    }

    return [codes.reduce((result, code) => {
        result = result ^ code.reduce((r, v, i) => {
            return r + v * Math.pow(36, i);
        }, 0);
        return result;
    }, 0)];
}
function vsHash(text) {
    let codes = [];
    let pos = 0;
    let partPos = 0;
    for (let i = 0; i < text.length; i++) {
        if (!codes[pos]) codes[pos]=[];
        let code = decodeCharCode2Int36(text.charCodeAt(i));
        if (code !== null) {
            codes[pos][partPos] = code;
            partPos += 1;
        }
        if (partPos === LEN) {
            partPos = 0;
            pos += 1;
        }
    }

    if (partPos) {
        for (let i = 0; i < LEN - partPos; i++) {
            codes[pos].push(0);
        }
    }

    return [codes.reduce((result, code) => {
        result = result ^ code.reduce((r, v, i) => {
            return r + v * Math.pow(36, i);
        }, 0);
        return result;
    }, 0)];
}
function vsHash ( text ) { let codes = [ ] ; let pos = 0 ; let partPos = 0 ; for ( let i = 0 ; i < text . length ; i ++ ) { if ( ! codes [ pos ] ) codes [ pos ] = [ ] ; let code = decodeCharCode2Int36 ( text . charCodeAt ( i ) ) ; if ( code !== null ) { codes [ pos ] [ partPos ] = code ; partPos += 1 ; } if ( partPos === LEN ) { partPos = 0 ; pos += 1 ; } } if ( partPos ) { for ( let i = 0 ; i < LEN - partPos ; i ++ ) { codes [ pos ] . push ( 0 ) ; } } return [ codes . reduce ( ( result , code ) => { result = result ^ code . reduce ( ( r , v , i ) => { return r + v * Math . pow ( 36 , i ) ; } , 0 ) ; return result ; } , 0 ) ] ; }
hashes string value
@param text
@returns {Array}
hashes string value