List of usage examples for android.util Base64 NO_PADDING
int NO_PADDING
To view the source code for android.util Base64 NO_PADDING.
Click Source Link
From source file:Main.java
public static String base64Encode(byte[] in) { String encoded = null;//from w ww.jav a 2s .c om try { encoded = new String(Base64.encode(in, Base64.URL_SAFE | Base64.NO_PADDING), "UTF8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return encoded; }
From source file:Main.java
public static String base64UrlEncode(byte[] arg) { return Base64.encodeToString(arg, 0, arg.length, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING); }
From source file:Main.java
public static byte[] decode(String base64) throws Exception { return Base64.decode(base64.getBytes(), Base64.NO_PADDING); }
From source file:Main.java
public static String encodeUrlSafe64(byte[] array) { int flags = Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE; return Base64.encodeToString(array, flags); }
From source file:Main.java
public static String generateShortUuid() { UUID uuid = UUID.randomUUID(); MessageDigest md = null;//from w w w .ja v a 2 s . c o m try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return uuid.toString(); } md.update(uuid.toString().getBytes()); byte[] digest = md.digest(); return Base64.encodeToString(digest, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING).substring(0, 20); }
From source file:Main.java
static byte[] decodeB64NP(String s64) { return Base64.decode(s64, Base64.NO_PADDING); }
From source file:Main.java
public static String makeSHA1HashBase64(byte[] bytes) { try {/*from www . ja v a 2 s.c om*/ MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(bytes, 0, bytes.length); byte[] sha1hash = md.digest(); return Base64.encodeToString(sha1hash, Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
From source file:Main.java
static String encodeB64NP(byte[] bytes) { return Base64.encodeToString(bytes, Base64.NO_PADDING); }
From source file:Main.java
static String encodeB64(byte[] bytes) { try {/* w ww . j a v a2 s. c o m*/ return Base64.encodeToString(bytes, Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP); } catch (Exception e) { } return null; }
From source file:com.skubit.android.billing.BillingServiceBinder.java
public static String hash(byte[] message) { int flag = Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE; try {//from ww w . j a va 2s . c o m MessageDigest md = MessageDigest.getInstance("MD5"); md.update(message); return Base64.encodeToString(md.digest(), flag); } catch (NoSuchAlgorithmException localNoSuchAlgorithmException) { } return null; }