    001package net.minecraft.util;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.math.BigInteger;
    006import java.security.MessageDigest;
    007import java.security.NoSuchAlgorithmException;
    008
    009@SideOnly(Side.CLIENT)
    010public 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}