Android Utililty Methods Password Encrypt

List of utility methods to do Password Encrypt

Description

The list of methods to do Password Encrypt are organized into topic(s).

Method

Stringencrypt(String password, String data)
encrypt
byte[] secretKey = generateKey(password.getBytes());
byte[] clear = data.getBytes();
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey,
        CIPHER_ALGORITHM);
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
byte[] encrypted = cipher.doFinal(clear);
String encryptedString = Base64.encodeToString(encrypted,
...
StringencryptionKey(String password)
encryption Key
byte[] keyByte1 = key1.getBytes();
byte[] keyByte2 = key2.getBytes();
byte[] pwdByte = password.getBytes();
for (int i = 0; i < pwdByte.length; i++) {
    pwdByte[i] = (byte) (pwdByte[i] ^ keyByte1[i % keyByte1.length]);
byte[] countByte = new byte[pwdByte.length + keyByte1.length];
for (int i = 0; i < countByte.length; i++) {
...
StringencryptionKey(String password)
encryption Key
byte[] keyByte1 = key1.getBytes();
byte[] keyByte2 = key2.getBytes();
byte[] pwdByte = password.getBytes();
for (int i = 0; i < pwdByte.length; i++) {
    pwdByte[i] = (byte) (pwdByte[i] ^ keyByte1[i % keyByte1.length]);
byte[] countByte = new byte[pwdByte.length + keyByte1.length];
for (int i = 0; i < countByte.length; i++) {
...