private static String removeBR(String str) {
StringBuffer sf = new StringBuffer(str);
for (int i = 0; i < sf.length(); ++i)
{
if (sf.charAt(i) == '\n')
{
sf = sf.deleteCharAt(i);
}
}
for (int i = 0; i < sf.length(); ++i)
if (sf.charAt(i) == '\r')
{
sf = sf.deleteCharAt(i);
}
return sf.toString();
}
public static String padding(String str)
{
byte[] oldByteArray;
try
{
oldByteArray = str.getBytes("UTF8");
int numberToPad = 8 - oldByteArray.length % 8;
byte[] newByteArray = new byte[oldByteArray.length + numberToPad];
System.arraycopy(oldByteArray, 0, newByteArray, 0, oldByteArray.length);
for (int i = oldByteArray.length; i < newByteArray.length; ++i)
{
newByteArray = 0;
}
return new String(newByteArray, "UTF8");
}
catch (UnsupportedEncodingException e)
{
System.out.println("Crypter.padding UnsupportedEncodingException");
}
return null;
}
public static byte[] removePadding(byte[] oldByteArray)
{
int numberPaded = 0;
for (int i = oldByteArray.length; i >= 0; --i)
{
if (oldByteArray[(i - 1)] != 0)
{
numberPaded = oldByteArray.length - i;
break;
}
}