Encryption on Android

Asked

Viewed 121 times

1

I want to save information inside a database on Android.

But for the sake of security, I’d like to encrypt this information.

Does anyone have any simple code for this? (and that it is possible to reverse).

  • What types of fields do you want to have encrypted? Just a specific column? A particular set of columns? Do you want to encrypt numeric fields and foreign keys as well? Want to encrypt all binary database data?

  • You could store the information coded with AES, and use the keys remotely to decode this information on the server and pass it on to the user for example. The end user could not decode because only the server(server-side) could encode and decode. Leaving the user only the result of the operation.

1 answer

0

I have this example of encryption I once used:

String senha= "";  
MessageDigest md = null;  
try {  
     md = MessageDigest.getInstance("MD5");  
} catch (NoSuchAlgorithmException e) {  
     e.printStackTrace();  
}  
BigInteger hash = new BigInteger(1, md.digest(pass.getBytes()));  
senha= hash.toString(16);  

basically only converts string, but can adapt, already has something to base.

  • 2

    That’s not encryption, you’re just hashing. Cryptography means something reversible, from where it is possible to recover the original text from the encrypted text. In hash, such an operation is not possible.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.