public static String des(int type, String text, BigInteger ms)
	{
		BASE64Encoder encoder;
		BASE64Decoder decoder;
		String returnString = new String();
		String secret = ms.toString();
		IvParameterSpec iv = new IvParameterSpec(msToBytes(Integer.parseInt((ms.toString().substring(0, 8)))));

		try
		{
			DESedeKeySpec key = new DESedeKeySpec(secret.getBytes());
			SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
			Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");
			cipher.init(type, keyFactory.generateSecret(key), iv);

			if (type == 1)
			{
				byte[] unencryptedByteArray = text.getBytes("UTF8");
				byte[] encryptedBytes = cipher.doFinal(unencryptedByteArray);
				encoder = new BASE64Encoder();
				returnString = encoder.encode(encryptedBytes);
			} else if (type == 2)
			{
				decoder = new BASE64Decoder();
				byte[] encryptedText = decoder.decodeBuffer(text);
				byte[] plainText = cipher.doFinal(encryptedText);
				returnString = new String(plainText);
			} else
				return null;

		} catch (Exception e)
		{
			System.out.println(e);
		}

		return returnString;
	}