Removed debug.

Changed getHash to return the Base64 of the SHA-256 of the input.
This commit is contained in:
dev
2011-07-01 14:13:52 +00:00
parent acc97b01c9
commit 65a8435141
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,6 @@ public class I2PControlController{
// throw new IllegalArgumentException("Plugin directory " + pluginDir.getAbsolutePath() + " does not exist");
System.out.println(net.i2p.i2pcontrol.security.jbcrypt.BCrypt.hashpw("itoopie","$2a$11$5aOLx2x/8i4fNaitoCSSWu"));
_server = new Server();
try {
SslListener ssl = new SslListener();

View File

@ -26,6 +26,8 @@ import javax.net.SocketFactory;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import com.sun.org.apache.xml.internal.security.utils.Base64;
import sun.misc.BASE64Encoder;
@ -109,7 +111,7 @@ public class SecurityManager {
}
/**
* Hash input one time with SHA-256.
* Hash input one time with SHA-256, return Base64 encdoded string.
* @param string
* @return
*/
@ -117,7 +119,7 @@ public class SecurityManager {
SHA256Generator hashGen = new SHA256Generator(I2PAppContext.getGlobalContext());
byte[] bytes = string.getBytes();
bytes = hashGen.calculateHash(bytes).toByteArray();
return new String(bytes);
return new String(Base64.encode(bytes));
}