[摘要]package zte.util;import java.io.*; // needed only for main() method./** * 将字符串用64位加密算法加密 * Title:销售...
package zte.util;
import java.io.*; // needed only for main() method.
/**
* 将字符串用64位加密算法加密
* Title:销售自动化软件
* Description:实现销售人员能够将销售过程通过一个软件就能管理起来。同时相互之间能够共享信息。
* 兼容以前的ACT,OUTLOOK软件。
* 与OFFICE软件集成。
* Copyright:Copyright (c) 2001
* Company:TCL企业软件有限责任公司
* @author TONY.郑
* @date 17 March 2000
* @version1.0
*/
//////////////////////license & copyright header/////////////////////////
// //
//Base64 - encode/decode data using the Base64 encoding scheme //
// //
//Copyright (c) 1998 by Kevin Kelley //
// //
// This library is free software; you can redistribute it and/or //
// modify it under the terms of the GNU Lesser General Public//
// License as published by the Free Software Foundation; either//
// version 2.1 of the License, or (at your option) any later version.//
// //
// This library is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of//
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the //
// GNU Lesser General Public License for more details. //
// //
// You should have received a copy of the GNU Lesser General Public//
// License along with this library; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA //
// 02111-1307, USA, or contact the author: //
// //
// Kevin Kelley <kelley@ruralnet.net> - 30718 Rd. 28, La Junta, CO,//
// 81050USA. //
// //
////////////////////end license & copyright header///////////////////////
import java.io.*; // needed only for main() method.
/**
* Provides encoding of raw bytes to base64-encoded characters, and
* decoding of base64 characters to raw bytes.
* 用于加密算法,64位加密软件
* @author Kevin Kelley (kelley@ruralnet.net)
* @version 1.3
* @date 06 August 1998
* @modified 14 February 2000
* @modified 22 September 2000
*/
public class Base64 {
/**
* returns an array of base64-encoded characters to represent the
* passed data array.
*
* @param data the array of bytes to encode
* @return base64-coded character array.
*/
static public char[] encode(byte[] data)
{
char[] out = new char[((data.length + 2) / 3) * 4];
//
// 3 bytes encode to 4 chars.Output is always an even
// multiple of 4 characters.
//
for (int i=0, index=0; i<data.length; i+=3, index+=4) {
boolean quad = false;
boolean trip = false;
int val = (0xFF & (int) data[i]);
val <<= 8;
if ((i+1) < data.length) {
val (北联网教程,专业提供视频软件下载)
……