## Javascript - <strike>192</strike> <strike>157</strike> <strike>152</strike> <strike>147</strike> 125

Ok some of these languages are a lot more flexibile than I thought!  Anyway this is the longer way I guess, but a different technique at least.


**Compressed**

Thanks to Peter and David for squeezing more chars out!

    for(a=[j=p=2];j<123;)a[j]?p%a[++j]<1&&p++&&(j=0):(a[j]=p,j=0);function b(c,i){return c[i=i||0]?a[c.charCodeAt(i)]*b(c,++i):1}

Then do:

    alert(b("hello")==b("elloh"));

**Expanded Code**

The compressed has had lots of changes, but this is the basic theory:

    // Define dictionary of primes
    a = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101];

    // Returns the unique ID of the word (order irrelevant)
    function b(c) {
        r = 1;
        for (i = 0; i < c.length; i++)
            r *= a[c[i].charCodeAt(0) - 97];
        return r
    }
    
    alert(b("hello") == b("hlleo"));