易采站长站为您分析Android编程加密算法,结合实例分析了AES、Base64及RAS加密算法,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例总结了Android编程加密算法。,具体如下:
android常用加密算法之Base64加密算法:
- package com.long; /**
- * Copyright (C) 2010 The Android Open Source Project *
- * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at *
- * http://www.easck.com/licenses/LICENSE-2.0 *
- * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
- * limitations under the License. */
- import java.io.ByteArrayOutputStream; import java.io.IOException;
- import java.io.OutputStream; /*
- * @author long *
- */ public class Base64 {
- private static final char[] legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" .toCharArray();
- public static String encode(byte[] data) { int start = 0;
- int len = data.length; StringBuffer buf = new StringBuffer(data.length * 3 / 2);
- int end = len - 3; int i = start;
- int n = 0; while (i <= end) {
- int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 0x0ff) << 8)










