    001    package net.minecraft.util;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.math.BigInteger;
    006    import java.security.MessageDigest;
    007    import java.security.NoSuchAlgorithmException;
    008
    009    @SideOnly(Side.CLIENT)
    010    public class MD5String
    011    {
    012        /** The salt prepended to the string to be hashed */
    013        private String salt;
    014
    015        public MD5String(String par1Str)
    016        {
    017            this.salt = par1Str;
    018        }
    019
    020        /**
    021         * Gets the MD5 string
    022         */
    023        public String getMD5String(String par1Str)
    024        {
    025            try
    026            {
    027                String var2 = this.salt + par1Str;
    028                MessageDigest var3 = MessageDigest.getInstance("MD5");
    029                var3.update(var2.getBytes(), 0, var2.length());
    030                return (new BigInteger(1, var3.digest())).toString(16);
    031            }
    032            catch (NoSuchAlgorithmException var4)
    033            {
    034                throw new RuntimeException(var4);
    035            }
    036        }
    037    }