@@ -0,0 +1,1233 @@
+package com.dexode.util;%0A%0Aimport com.dexode.util.log.Logger;%0A%0Aimport java.math.BigInteger;%0Aimport java.security.MessageDigest;%0A%0A/**%0A * Created by Dawid Drozd aka Gelldur on 11.03.15.%0A */%0Apublic class UtilsHash %7B%0A%0A%09public static String md5(String input) %7B%0A%09%09MessageDigest digest;%0A%09%09try %7B%0A%09%09%09byte%5B%5D bytes = input.getBytes(%22UTF-8%22);%0A%0A%09%09%09digest = MessageDigest.getInstance(%22MD5%22);%0A%09%09%09digest.update(bytes);%0A%09%09%09return new BigInteger(1, digest.digest()).toString(16);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09Logger.e(e);%0A%09%09%7D%0A%09%09return %22no_hash%22;%0A%09%7D%0A%0A%09public static String sha1(String input) %7B%0A%09%09MessageDigest digest;%0A%09%09try %7B%0A%09%09%09byte%5B%5D bytes = input.getBytes(%22UTF-8%22);%0A%0A%09%09%09digest = MessageDigest.getInstance(%22SHA1%22);%0A%09%09%09digest.update(bytes);%0A%09%09%09return new BigInteger(1, digest.digest()).toString(16);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09Logger.e(e);%0A%09%09%7D%0A%09%09return %22no_hash%22;%0A%09%7D%0A%0A%09public static boolean compareMd5(String left, String right) %7B%0A%09%09if (left == null %7C%7C right == null) %7B%0A%09%09%09//Yes compre references. If we have 2x null then ok else it will return false%0A%09%09%09return left == right;%0A%09%09%7D%0A%0A%09%09BigInteger bigIntegerLeft = new BigInteger(left, 16);%0A%09%09BigInteger bigIntegerRight = new BigInteger(right, 16);%0A%09%09return bigIntegerLeft.equals(bigIntegerRight);%0A%09%7D%0A%0A%7D%0A

Add UtilsHash with popular hashes