Closed GoogleCodeExporter closed 9 years ago
Quick Fix for good job.
package com.googlecode.gwt.crypto.util;
public class Str {
private static int[] delta;
public static byte[] toBytes(char[] inputChars) {
byte[] out = new byte[inputChars.length];
delta = new int[inputChars.length];
for (int i = 0; i < inputChars.length; i++) {
out[i] = (byte) inputChars[i];
delta[i] = (int) inputChars[i] - out[i];
}
return out;
}
public static char[] toChars(byte[] in) {
char[] out = new char[in.length];
for (int i = 0; i < in.length; i++) {
if (i < delta.length) {
out[i] = (char) (in[i] + delta[i]);
} else {
out[i] = (char) in[i];
}
}
return out;
}
}
Original comment by stsefane...@gmail.com
on 7 Sep 2009 at 11:17
Thanks for your fix!
Checked it in, as well as a test that should keep this from happening again.
Original comment by moor...@gmail.com
on 4 Oct 2009 at 3:52
Original issue reported on code.google.com by
stsefane...@gmail.com
on 3 Sep 2009 at 10:57