package org.simpleim.server.util;

import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.concurrent.atomic.AtomicLong;

public final class AccountGenerator {
	private static final AtomicLong COUNTER = new AtomicLong(Preference.getAmountOfUser());
	private static final SecureRandom random = new SecureRandom();

	// 禁止实例化
	private AccountGenerator() {}

	public static String nextId() {
		return Long.toString(COUNTER.incrementAndGet(), Character.MAX_RADIX) +
				Long.toString(System.currentTimeMillis(), Character.MAX_RADIX);
	}
	public static long currentCounter() {
		return COUNTER.get();
	}

	public static String generatePassword() {
		return new BigInteger(1024, random).toString(Character.MAX_RADIX);
	}
}

@@ -32,37 +32,8 @@
 l;%0A%0A
-import java.math.BigInteger;%0A
 impo
@@ -111,16 +111,54 @@
 cLong;%0A%0A
+import com.lambdaworks.codec.Base64;%0A%0A
 public f
@@ -676,72 +676,130 @@
 %7B%0A%09%09
-return new BigInteger(1024, random).toString(Character.MAX_RADIX
+byte%5B%5D password = new byte%5B1024%5D;%0A%09%09random.nextBytes(password);%0A%09%09return String.copyValueOf(Base64.encode(password, false)
 );%0A%09

change the algorithm of generatePassword()