List of utility methods to do String Encrypt
String | encrypt(String keyStr, String plainText) encrypt byte[] encrypt = null; try { Key key = generateKey(keyStr); Cipher cipher = Cipher.getInstance(AESTYPE); cipher.init(Cipher.ENCRYPT_MODE, key); encrypt = cipher.doFinal(plainText.getBytes()); } catch (Exception e) { e.printStackTrace(); ... |
String | encrypt(String seed, String cleartext) encrypt byte[] rawKey = getRawKey(seed.getBytes()); byte[] result = encrypt(rawKey, cleartext.getBytes()); return toHex(result); |
String | encrypt(String str) encrypt String key = "a12348a9gde"; StringBuilder sb = new StringBuilder(); try { byte[] data = str.getBytes("UTF-8"); byte[] keyData = key.getBytes("UTF-8"); for (int i = 0; i < data.length; i++) { String s = String.format("%02X", data[i] & 0xFF ^ keyData[i % keyData.length] & 0xFF); ... |