From b71ada8ff883cd89c8a992c8369a1c50577761ae Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 3 Apr 2017 12:24:18 -0400 Subject: [PATCH] cache: add djb2 manager with a couple hashes dumped from the client --- .../net/runelite/cache/util/Djb2Manager.java | 60 +++++++++++++++++++ cache/src/main/resources/djb2.properties | 31 ++++++++++ 2 files changed, 91 insertions(+) create mode 100644 cache/src/main/java/net/runelite/cache/util/Djb2Manager.java create mode 100644 cache/src/main/resources/djb2.properties diff --git a/cache/src/main/java/net/runelite/cache/util/Djb2Manager.java b/cache/src/main/java/net/runelite/cache/util/Djb2Manager.java new file mode 100644 index 0000000000..5db676fd26 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/util/Djb2Manager.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.cache.util; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Djb2Manager +{ + private static final Logger logger = LoggerFactory.getLogger(Djb2Manager.class); + + private final Map hashes = new HashMap<>(); + + public void load() throws IOException + { + Properties properties = new Properties(); + properties.load(Djb2Manager.class.getResourceAsStream("/djb2.properties")); + + for (Object key : properties.keySet()) + { + int hash = Integer.parseInt((String) key); + String value = properties.getProperty((String) key); + + hashes.put(hash, value); + } + + logger.info("Loaded {} djb2 hashes", hashes.size()); + } + + public String getName(int hash) + { + return hashes.get(hash); + } +} diff --git a/cache/src/main/resources/djb2.properties b/cache/src/main/resources/djb2.properties new file mode 100644 index 0000000000..ca1f1fa01b --- /dev/null +++ b/cache/src/main/resources/djb2.properties @@ -0,0 +1,31 @@ +#Mon Apr 03 10:30:23 EDT 2017 +3327403=logo +950484242=compass +-1773559904=title_mute +755433248=headicons_pk +-342013218=p11_full +837204902=mapdots +417793574=scrollbar +-1154558416=sl_arrows +1057075019=b12_full +2110231453=mod_icons +1170407052=headicons_prayer +-1544597765=sl_stars +837223705=mapedge +-1335336992=logo_deadman_mode +1120933843=scape main +1956141538=options_radio_buttons,2 +1258058669=huffman +1956141536=options_radio_buttons,0 +1639695510=mapmarker +108875897=runes +-2136884405=title.jpg +121641580=headicons_hint +947464074=titlebutton +-2128560371=sl_back +-1556842207=sl_flags +-1123094568=sl_button +94935104=cross +197029040=mapscene +-1869996941=titlebox +628358452=mapfunction