@@ -0,0 +1,2057 @@
+package com.momana.bhromo.memoir.database;%0Aimport android.util.Base64;%0A%0Aimport java.security.spec.AlgorithmParameterSpec;%0Aimport java.security.spec.KeySpec;%0A%0Aimport javax.crypto.Cipher;%0Aimport javax.crypto.SecretKey;%0Aimport javax.crypto.SecretKeyFactory;%0Aimport javax.crypto.spec.PBEKeySpec;%0Aimport javax.crypto.spec.PBEParameterSpec;%0A%0Apublic class StringEncryption %7B%0A    Cipher ecipher;%0A    Cipher dcipher;%0A%0A    // 8-byte Salt%0A    byte%5B%5D salt = %7B%0A            (byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,%0A            (byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03%0A    %7D;%0A%0A    int iterationCount = 19;%0A%0A    public StringEncryption(String pass) %7B%0A        try %7B%0A            // Create the key%0A            KeySpec keySpec = new PBEKeySpec(pass.toCharArray(), salt, iterationCount);%0A%0A            SecretKey key = SecretKeyFactory.getInstance(%22PBEWithMD5AndDES%22).generateSecret(keySpec);%0A            ecipher = Cipher.getInstance(key.getAlgorithm());%0A            dcipher = Cipher.getInstance(key.getAlgorithm());%0A%0A            // Prepare the parameter to the ciphers%0A            AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);%0A%0A            // Create the ciphers%0A            ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);%0A            dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);%0A        %7D catch (Exception ignored) %7B%7D%0A    %7D%0A%0A    public String encrypt(String str) throws Exception %7B%0A        // Encode the string into bytes using utf-8%0A        byte%5B%5D utf8 = str.getBytes(%22UTF8%22);%0A        // Encrypt%0A        byte%5B%5D enc = ecipher.doFinal(utf8);%0A        // Encode bytes to base64 to get a string%0A        return Base64.encodeToString(enc, Base64.DEFAULT);%0A    %7D%0A%0A    public String decrypt(String str) throws Exception %7B%0A        // Decode base64 to get bytes%0A        // byte%5B%5D dec = new sun.misc.BASE64Decoder().decodeBuffer(str);%0A        byte%5B%5D dec = Base64.decode(str, Base64.DEFAULT);%0A        // Decrypt%0A        byte%5B%5D utf8 = dcipher.doFinal(dec);%0A        // Decode using utf-8%0A        return new String(utf8, %22UTF8%22);%0A    %7D%0A%7D%0A%0A

Create StringEncryption class