public static void main(String[] args) { String pwd = "admin"; String md5 = md5(pwd); String cnd = encode(pwd); String rtn = decode(cnd); String sha256 = sha256(pwd); String sha2562 = sha2562(pwd); System.out.println("'" + pwd + "'"); System.out.println("'" + md5 + "'"); System.out.println("'" + cnd + "'"); System.out.println("'" + rtn + "'"); System.out.println("'" + sha256 + "'"); System.out.println("'" + sha2562 + "'"); } }
public static String encode(String plain) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainBytes = padding(new DataOutputX().writeText(plain).toByteArray()); byte[] encoded = cipher.doFinal(plainBytes); return Base64.encode(encoded); } catch (Exception e) { e.printStackTrace(); } return null; }
public static String decode(String encoded) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] cyper = Base64.decode(encoded); byte[] decoded = cipher.doFinal(cyper); return new DataInputX(decoded).readText(); } catch (Exception e) { e.printStackTrace(); } return null; }
public static LoginRequest login(Server server) { String encPassword = CipherUtil.sha256(server.getPassword()); server.setSecureMode(true); return loginInternal(server, server.getUserId(), encPassword); }
public static String decode(String encoded) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] cyper = Base64.decode(encoded); byte[] decoded = cipher.doFinal(cyper); return new DataInputX(decoded).readText(); } catch (Exception e) { e.printStackTrace(); } return null; }
/** * id & password check from scouter collector server */ public boolean login(final Server server, final SUser user) { MapPack param = new MapPack(); param.put(ParamConstant.USER_ID, user.getId()); param.put(ParamConstant.USER_PASSWROD, CipherUtil.sha256(user.getPassword())); Value value; try (TcpProxy tcpProxy = TcpProxy.getTcpProxy(server)) { value = tcpProxy.getSingleValue(RequestCmd.CHECK_LOGIN, param); } return ((BooleanValue) value).value; } }
public static void main(String[] args) { String pwd = "admin"; String md5 = md5(pwd); String cnd = encode(pwd); String rtn = decode(cnd); String sha256 = sha256(pwd); String sha2562 = sha2562(pwd); System.out.println("'" + pwd + "'"); System.out.println("'" + md5 + "'"); System.out.println("'" + cnd + "'"); System.out.println("'" + rtn + "'"); System.out.println("'" + sha256 + "'"); System.out.println("'" + sha2562 + "'"); } }
public static String encode(String plain) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainBytes = padding(new DataOutputX().writeText(plain).toByteArray()); byte[] encoded = cipher.doFinal(plainBytes); return Base64.encode(encoded); } catch (Exception e) { e.printStackTrace(); } return null; }
public static String decode(String encoded) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] cyper = Base64.decode(encoded); byte[] decoded = cipher.doFinal(cyper); return new DataInputX(decoded).readText(); } catch (Exception e) { e.printStackTrace(); } return null; }
public static LoginRequest login(Server server) { String encPassword = CipherUtil.sha256(server.getPassword()); server.setSecureMode(true); return loginInternal(server, server.getUserId(), encPassword); }
public static void main(String[] args) { String pwd = "admin"; String md5 = md5(pwd); String cnd = encode(pwd); String rtn = decode(cnd); String sha256 = sha256(pwd); String sha2562 = sha2562(pwd); System.out.println("'" + pwd + "'"); System.out.println("'" + md5 + "'"); System.out.println("'" + cnd + "'"); System.out.println("'" + rtn + "'"); System.out.println("'" + sha256 + "'"); System.out.println("'" + sha2562 + "'"); } }
public static String encode(String plain) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainBytes = padding(new DataOutputX().writeText(plain).toByteArray()); byte[] encoded = cipher.doFinal(plainBytes); return Base64.encode(encoded); } catch (Exception e) { e.printStackTrace(); } return null; }
public static String decode(String encoded) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] cyper = Base64.decode(encoded); byte[] decoded = cipher.doFinal(cyper); return new DataInputX(decoded).readText(); } catch (Exception e) { e.printStackTrace(); } return null; }
/** * id & password check from scouter collector server */ public boolean login(final Server server, final SUser user) { MapPack param = new MapPack(); param.put(ParamConstant.USER_ID, user.getId()); param.put(ParamConstant.USER_PASSWROD, CipherUtil.sha256(user.getPassword())); Value value; try (TcpProxy tcpProxy = TcpProxy.getTcpProxy(server)) { value = tcpProxy.getSingleValue(RequestCmd.CHECK_LOGIN, param); } return ((BooleanValue) value).value; } }
public static void main(String[] args) { String pwd = "admin"; String md5 = md5(pwd); String cnd = encode(pwd); String rtn = decode(cnd); String sha256 = sha256(pwd); String sha2562 = sha2562(pwd); System.out.println("'" + pwd + "'"); System.out.println("'" + md5 + "'"); System.out.println("'" + cnd + "'"); System.out.println("'" + rtn + "'"); System.out.println("'" + sha256 + "'"); System.out.println("'" + sha2562 + "'"); } }
public static String encode(String plain) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainBytes = padding(new DataOutputX().writeText(plain).toByteArray()); byte[] encoded = cipher.doFinal(plainBytes); return Base64.encode(encoded); } catch (Exception e) { e.printStackTrace(); } return null; }
public static String decode(String encoded) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] cyper = Base64.decode(encoded); byte[] decoded = cipher.doFinal(cyper); return new DataInputX(decoded).readText(); } catch (Exception e) { e.printStackTrace(); } return null; }
public static void main(String[] args) { String pwd = "admin"; String md5 = md5(pwd); String cnd = encode(pwd); String rtn = decode(cnd); String sha256 = sha256(pwd); String sha2562 = sha2562(pwd); System.out.println("'" + pwd + "'"); System.out.println("'" + md5 + "'"); System.out.println("'" + cnd + "'"); System.out.println("'" + rtn + "'"); System.out.println("'" + sha256 + "'"); System.out.println("'" + sha2562 + "'"); } }
public static String encode(String plain) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainBytes = padding(new DataOutputX().writeText(plain).toByteArray()); byte[] encoded = cipher.doFinal(plainBytes); return Base64.encode(encoded); } catch (Exception e) { e.printStackTrace(); } return null; }
public static String decode(String encoded) { try { Key key = genKey(); Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] cyper = Base64.decode(encoded); byte[] decoded = cipher.doFinal(cyper); return new DataInputX(decoded).readText(); } catch (Exception e) { e.printStackTrace(); } return null; }