coryshrmn / websitecatalog

0 stars 1 forks source link

Problem with HashManager #16

Closed ghost closed 11 years ago

ghost commented 11 years ago

Priority (stack order): (1) hashSearch has problem (2) therefore hashRemove returns problem.

ghost commented 11 years ago

In the hashString(), why do we assign the following statement:

h = 31h + w

What does 31 represent exactly?

coryshrmn commented 11 years ago

I got the hashing algorithm from Java. I don't know why they used 31. It's pretty similar to FNV hashing, except it uses addition instead of XOR.

http://www.docjar.com/docs/api/java/lang/String.html#hashCode

ghost commented 11 years ago

Okay. I found the issue. The value is the same not because it's not modified, but because the limit of int value representation.

31 * h is returning fairly large number, and it quickly reaches to the limit of the int value, therefore returning the random value if the url is longer than few characters.

We need to modify the hashString(). I'll try to use it with

long long int h = 0;

and something like 3 * h instead of 31 * h;

coryshrmn commented 11 years ago

The number is supposed to wrap around. When there is multiplication overflow, the result is the lowest 32 bits of the product. I'm pretty sure it works fine.

ghost commented 11 years ago

I just verified that this hash algorithm returns no duplicate for all topsites.

value before hashing is -1013768776 for olx.in. value before hashing is -1033126725 for guardian.co.uk. value before hashing is -1041081720 for googleusercontent.com. value before hashing is -1050609565 for mywebsearch.com. value before hashing is -1077215506 for commentcamarche.net. value before hashing is -1088003224 for etsy.com. value before hashing is -1099462002 for joomla.org. value before hashing is -110124848 for bild.de. value before hashing is -1138563064 for kat.ph. value before hashing is -1140040712 for searchfunmoods.com. value before hashing is -1147555696 for softpedia.com. value before hashing is -1168589105 for marca.com. value before hashing is -1169098182 for ebay.com.au. value before hashing is -117971675 for netflix.com. value before hashing is -1185850056 for in.com. value before hashing is -1188370705 for wordpress.org. value before hashing is -1188382324 for wordpress.com. value before hashing is -1189543665 for uploaded.net. value before hashing is -1190761622 for doubleclick.com. value before hashing is -1193989884 for icicibank.com. value before hashing is -1212632165 for hp.com. value before hashing is -1217880458 for w3schools.com. value before hashing is -1227903965 for yelp.com. value before hashing is -1228239700 for depositfiles.com. value before hashing is -1242184837 for go.com. value before hashing is -1257716438 for pandora.com. value before hashing is -1258582756 for scribd.com. value before hashing is -126702959 for adultfriendfinder.com. value before hashing is -1289806311 for soundcloud.com. value before hashing is -1299203208 for maktoob.com. value before hashing is -1300758257 for dropbox.com. value before hashing is -1310538978 for uimserv.net. value before hashing is -1311829293 for yahoo.com. value before hashing is -1322709971 for livedoor.com. value before hashing is -1322711105 for livedoor.biz. value before hashing is -1328826067 for wikipedia.org. value before hashing is -1333434991 for conduit.com. value before hashing is -1350982438 for flickr.com. value before hashing is -1361319046 for cj.com. value before hashing is -1361444347 for fiverr.com. value before hashing is -1368043787 for biglobe.ne.jp. value before hashing is -1371992977 for tumblr.com. value before hashing is -138012666 for paypal.com. value before hashing is -1398120529 for blogspot.in. value before hashing is -1408499620 for ask.fm. value before hashing is -1410119630 for warriorforum.com. value before hashing is -1412368979 for directrev.com. value before hashing is -1422501192 for adf.ly. value before hashing is -1426426751 for microsoft.com. value before hashing is -1457674547 for hurriyet.com.tr. value before hashing is -1457966992 for yourlust.com. value before hashing is -1462649350 for putlocker.com. value before hashing is -1507576159 for leboncoin.fr. value before hashing is -1520351745 for tagged.com. value before hashing is -1522393035 for livejasmin.com. value before hashing is -1536293812 for google.com. value before hashing is -1542825754 for mozilla.org. value before hashing is -1552693521 for comcast.net. value before hashing is -155551562 for goo.ne.jp. value before hashing is -1557529491 for myspace.com. value before hashing is -1579833618 for amazon.co.uk. value before hashing is -1579833954 for amazon.co.jp. value before hashing is -159567326 for dailymotion.com. value before hashing is -1605746007 for csdn.net. value before hashing is -1610658671 for linkedin.com. value before hashing is -1612563152 for etao.com. value before hashing is -1624104343 for blackhatworld.com. value before hashing is -1625231154 for telegraph.co.uk. value before hashing is -1655930713 for sweetim.com. value before hashing is -1661023164 for empowernetwork.com. value before hashing is -1666347095 for akamaihd.net. value before hashing is -1671563072 for doublepimp.com. value before hashing is -1679884047 for youjizz.com. value before hashing is -1714137107 for cnet.com. value before hashing is -17170501 for pixiv.net. value before hashing is -1721665370 for repubblica.it. value before hashing is -1735163193 for tube8.com. value before hashing is -1740134003 for wellsfargo.com. value before hashing is -1744043896 for detik.com. value before hashing is -1745464020 for typepad.com. value before hashing is -174829123 for bravotube.net. value before hashing is -1752349395 for pinterest.com. value before hashing is -1761149136 for thepiratebay.se. value before hashing is -1764350597 for terra.com.br. value before hashing is -1786585981 for mailchimp.com. value before hashing is -1802373298 for bloomberg.com. value before hashing is -1822709958 for dailymail.co.uk. value before hashing is -182982709 for 888.com. value before hashing is -1830313082 for twitter.com. value before hashing is -1864432623 for seomoz.org. value before hashing is -1869376272 for rapidgator.net. value before hashing is -1871334176 for movie2k.to. value before hashing is -1875046223 for atwiki.jp. value before hashing is -1879838682 for youdao.com. value before hashing is -1884554752 for neobux.com. value before hashing is -1886736297 for clickbank.com. value before hashing is -1908383932 for examiner.com. value before hashing is -1915811533 for drtuber.com. value before hashing is -1920266189 for seznam.cz. value before hashing is -1945097032 for badoo.com. value before hashing is -1952518108 for ebay.it. value before hashing is -1952518114 for ebay.in. value before hashing is -1952518278 for ebay.de. value before hashing is -1957507183 for capitalone.com. value before hashing is -196855208 for cam4.com. value before hashing is -1974064650 for letitbit.net. value before hashing is -1995595811 for alipay.com. value before hashing is -201429974 for wikimedia.org. value before hashing is -2035378661 for odesk.com. value before hashing is -2036711631 for usatoday.com. value before hashing is -2040925048 for hdfcbank.com. value before hashing is -2042769993 for abril.com.br. value before hashing is -2052153688 for redtube.com. value before hashing is -2070517282 for livejournal.com. value before hashing is -2078478794 for espncricinfo.com. value before hashing is -2079885805 for naukri.com. value before hashing is -2091578331 for squidoo.com. value before hashing is -2095271699 for apple.com. value before hashing is -2111925458 for baidu.com. value before hashing is -2113390139 for blogspot.com.es. value before hashing is -2113390233 for blogspot.com.br. value before hashing is -220683207 for uol.com.br. value before hashing is -222112821 for ups.com. value before hashing is -23617107 for mediafire.com. value before hashing is -290506641 for hao123.com. value before hashing is -295116664 for answers.com. value before hashing is -296793265 for stumbleupon.com. value before hashing is -30788076 for bet365.com. value before hashing is -344740750 for salesforce.com. value before hashing is -353860204 for wordreference.com. value before hashing is -36303950 for hardsextube.com. value before hashing is -364826023 for facebook.com. value before hashing is -369931520 for outlook.com. value before hashing is -373274299 for instagram.com. value before hashing is -386178373 for kaskus.co.id. value before hashing is -392069065 for blogspot.com. value before hashing is -398525016 for ebay.com. value before hashing is -405298854 for pof.com. value before hashing is -413085442 for webmd.com. value before hashing is -420404065 for ku6.com. value before hashing is -428407038 for hubpages.com. value before hashing is -451049423 for huffingtonpost.com. value before hashing is -45507552 for fbcdn.net. value before hashing is -465605757 for jobrapido.com. value before hashing is -47313031 for 123rf.com. value before hashing is -473285229 for extratorrent.com. value before hashing is -488375560 for xtendmedia.com. value before hashing is -517072087 for secureserver.net. value before hashing is -529634268 for intuit.com. value before hashing is -557399142 for google.com.vn. value before hashing is -557399186 for google.com.ua. value before hashing is -557399242 for google.com.sg. value before hashing is -557399331 for google.com.pk. value before hashing is -557399334 for google.com.ph. value before hashing is -557399397 for google.com.ng. value before hashing is -557399410 for google.com.my. value before hashing is -557399676 for google.com.eg. value before hashing is -557399730 for google.com.co. value before hashing is -557399758 for google.com.br. value before hashing is -557399772 for google.com.bd. value before hashing is -557399786 for google.com.au. value before hashing is -557399789 for google.com.ar. value before hashing is -582863947 for java.com. value before hashing is -583440962 for stackexchange.com. value before hashing is -589696261 for outbrain.com. value before hashing is -596457433 for php.net. value before hashing is -631624603 for avg.com. value before hashing is -644585104 for delta-search.com. value before hashing is -676877132 for att.com. value before hashing is -702078286 for webs.com. value before hashing is -709679935 for taobao.com. value before hashing is -713817972 for ask.com. value before hashing is -726552755 for largeporntube.com. value before hashing is -730507841 for ebay.co.uk. value before hashing is -736342470 for forbes.com. value before hashing is -737629268 for 4shared.com. value before hashing is -747001624 for pch.com. value before hashing is -764724480 for xe.com. value before hashing is -775976477 for americanexpress.com. value before hashing is -779965899 for imdb.com. value before hashing is -78033866 for youtube.com. value before hashing is -795596813 for bannersbroker.com. value before hashing is -80507433 for bp.blogspot.com. value before hashing is -820519666 for tripadvisor.com. value before hashing is -827411055 for aol.com. value before hashing is -839518062 for w3.org. value before hashing is -857096264 for aili.com. value before hashing is -881715607 for skype.com. value before hashing is -892621564 for pengyou.com. value before hashing is -895260518 for spiegel.de. value before hashing is -954046285 for qq.com. value before hashing is -965500030 for indiatimes.com. value before hashing is -970687519 for goodgamestudios.com. value before hashing is -976430097 for alibaba.com. value before hashing is -985283713 for yoka.com. value before hashing is 1007969641 for informer.com. value before hashing is 1011246152 for mgid.com. value before hashing is 1030490846 for ehow.com. value before hashing is 1039769907 for wikihow.com. value before hashing is 1040117979 for ezinearticles.com. value before hashing is 1048474036 for 51job.com. value before hashing is 1052592056 for archive.org. value before hashing is 1061077489 for reddit.com. value before hashing is 1072789513 for xnxx.com. value before hashing is 1073712455 for mixi.jp. value before hashing is 1090339290 for google.co.hu. value before hashing is 1090339304 for google.co.id. value before hashing is 1090339314 for google.co.in. value before hashing is 1090339683 for google.co.uk. value before hashing is 1090339708 for google.co.ve. value before hashing is 1090339828 for google.co.za. value before hashing is 109211510 for softonic.com. value before hashing is 1100257225 for businessinsider.com. value before hashing is 110087831 for amazon.com. value before hashing is 1104811851 for rediff.com. value before hashing is 1107930907 for download.com. value before hashing is 111288580 for buzzfeed.com. value before hashing is 1146500789 for meetup.com. value before hashing is 1149470915 for washingtonpost.com. value before hashing is 1159061153 for clicksor.com. value before hashing is 1159072908 for amazonaws.com. value before hashing is 1178693774 for blogspot.co.uk. value before hashing is 1194051507 for claro-search.com. value before hashing is 120861075 for goodreads.com. value before hashing is 1209534344 for speedtest.net. value before hashing is 1244984957 for nuvid.com. value before hashing is 1245779889 for linkbucks.com. value before hashing is 1250477227 for amazon.de. value before hashing is 1250477302 for amazon.fr. value before hashing is 1250477397 for amazon.it. value before hashing is 125667463 for weather.com. value before hashing is 1257259391 for exoclick.com. value before hashing is 1297989556 for torrentz.eu. value before hashing is 1297989673 for torrentz.in. value before hashing is 1313956088 for linkwithin.com. value before hashing is 1335085517 for bbc.co.uk. value before hashing is 1342279801 for adnxs.com. value before hashing is 1349062171 for msn.com. value before hashing is 1357108089 for wix.com. value before hashing is 136817995 for weebly.com. value before hashing is 1416545663 for live.com. value before hashing is 1428415544 for beeg.com. value before hashing is 1461226585 for soku.com. value before hashing is 1474462744 for google.be. value before hashing is 1474462771 for google.ca. value before hashing is 1474462778 for google.ch. value before hashing is 1474462782 for google.cl. value before hashing is 1474462784 for google.cn. value before hashing is 1474462806 for google.de. value before hashing is 1474462827 for google.dz. value before hashing is 1474462872 for google.fi. value before hashing is 1474462881 for google.fr. value before hashing is 1474462912 for google.gr. value before hashing is 1474462961 for google.ie. value before hashing is 1474462976 for google.it. value before hashing is 1474463123 for google.nl. value before hashing is 1474463126 for google.no. value before hashing is 1474463193 for google.pt. value before hashing is 1474463250 for google.ro. value before hashing is 1474463256 for google.ru. value before hashing is 1474463271 for google.se. value before hashing is 1486713838 for popads.net. value before hashing is 1488829580 for orange.fr. value before hashing is 1512865535 for bleacherreport.com. value before hashing is 1535130495 for quikr.com. value before hashing is 1553353777 for groupon.com. value before hashing is 155757711 for constantcontact.com. value before hashing is 156477953 for gmx.net. value before hashing is 1587012866 for adobe.com. value before hashing is 1594923905 for chase.com. value before hashing is 1599802462 for reference.com. value before hashing is 1602346979 for t-online.de. value before hashing is 1608352797 for stackoverflow.com. value before hashing is 1630470305 for wsj.com. value before hashing is 1635546171 for it168.com. value before hashing is 1646255947 for walmart.com. value before hashing is 1668850948 for latimes.com. value before hashing is 171500452 for liveinternet.ru. value before hashing is 171935304 for engadget.com. value before hashing is 1720236453 for aliexpress.com. value before hashing is 1727735846 for goal.com. value before hashing is 1737864512 for nba.com. value before hashing is 1750464931 for ign.com. value before hashing is 1759298222 for bankofamerica.com. value before hashing is 1767699665 for ikea.com. value before hashing is 1773630589 for slideshare.net. value before hashing is 1783837139 for aweber.com. value before hashing is 1807696995 for xvideos.com. value before hashing is 1813313931 for fedex.com. value before hashing is 1823107254 for twoo.com. value before hashing is 1883351857 for profitclicking.com. value before hashing is 188449234 for addthis.com. value before hashing is 1916915062 for rapidshare.com. value before hashing is 1918347612 for shutterstock.com. value before hashing is 1921259178 for domaintools.com. value before hashing is 1944737069 for nih.gov. value before hashing is 1947889949 for optmd.com. value before hashing is 1948558702 for nytimes.com. value before hashing is 1966957502 for ilivid.com. value before hashing is 1983684359 for godaddy.com. value before hashing is 1985010934 for github.com. value before hashing is 2016673858 for avito.ru. value before hashing is 2052377306 for yahoo.co.jp. value before hashing is 205721496 for indeed.com. value before hashing is 2063111500 for ero-advertising.com. value before hashing is 2070007050 for irs.gov. value before hashing is 2099078884 for naver.jp. value before hashing is 212840481 for 1channel.ch. value before hashing is 2142269128 for babylon.com. value before hashing is 241148383 for hootsuite.com. value before hashing is 245813817 for gsmarena.com. value before hashing is 247807838 for milliyet.com.tr. value before hashing is 284949641 for zedo.com. value before hashing is 294615368 for zippyshare.com. value before hashing is 303931829 for foxnews.com. value before hashing is 318347483 for sourceforge.net. value before hashing is 321655744 for surveymonkey.com. value before hashing is 336830060 for booking.com. value before hashing is 353159303 for 9gag.com. value before hashing is 356750146 for mercadolivre.com.br. value before hashing is 364377828 for search-results.com. value before hashing is 367980486 for thefreedictionary.com. value before hashing is 391845522 for elmundo.es. value before hashing is 395465965 for 4dsply.com. value before hashing is 398200816 for blogfa.com. value before hashing is 399036682 for globo.com. value before hashing is 408335710 for turbobit.net. value before hashing is 423089483 for ndtv.com. value before hashing is 426232467 for taringa.net. value before hashing is 456132604 for libero.it. value before hashing is 466974645 for bestbuy.com. value before hashing is 48226100 for usps.com. value before hashing is 483255461 for sergey-mavrodi.com. value before hashing is 485469092 for target.com. value before hashing is 495304099 for deviantart.com. value before hashing is 498194735 for myfreecams.com. value before hashing is 504110804 for microsoftonline.com. value before hashing is 508927357 for xhamster.com. value before hashing is 522552837 for blogger.com. value before hashing is 528866025 for hulu.com. value before hashing is 563567667 for imgur.com. value before hashing is 584492757 for themeforest.net. value before hashing is 591307306 for zillow.com. value before hashing is 596565947 for statcounter.com. value before hashing is 601001227 for rutracker.org. value before hashing is 612882904 for match.com. value before hashing is 63665197 for pornhub.com. value before hashing is 669736469 for nbcnews.com. value before hashing is 686346389 for iminent.com. value before hashing is 725395177 for clixsense.com. value before hashing is 729407191 for vimeo.com. value before hashing is 736697511 for reuters.com. value before hashing is 746336611 for chip.de. value before hashing is 747281805 for samsung.com. value before hashing is 75223254 for mashable.com. value before hashing is 759290867 for accuweather.com. value before hashing is 816775192 for flipkart.com. value before hashing is 824090580 for dell.com. value before hashing is 825255011 for nifty.com. value before hashing is 859740285 for espn.go.com. value before hashing is 862440401 for histats.com. value before hashing is 863146779 for tmall.com. value before hashing is 868394024 for theexgirlfriends.com. value before hashing is 892191874 for searchnu.com. value before hashing is 91124052 for abcnews.go.com. value before hashing is 920814198 for cnn.com. value before hashing is 941125331 for bing.com. value before hashing is 945959443 for yieldmanager.com. value before hashing is 976982701 for youporn.com. value before hashing is 988091792 for incredibar.com. value before hashing is 995670059 for isohunt.com.