Android examples for java.security:Decrypt Encrypt
generate Salt from Base64
//package com.java2s; import java.security.SecureRandom; import android.util.Base64; public class Main { public static String generateSalt() { SecureRandom sr = new SecureRandom(); byte[] salt = new byte[8]; sr.nextBytes(salt);//from w w w . j ava 2s. c o m return Base64.encodeToString(salt, Base64.DEFAULT); } }