国产午夜成人免费看片无遮挡_日本免费xxxx色视频_免费人成网上在线观看_黄网址在线永久免费观看

當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

Base64,enjoy!

Base64,enjoy!

更新時間:2022-04-27 文章作者:未知 信息來源:網絡 閱讀次數:

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 |= (0xFF & (int) data[i+1]);
trip = true;
}
val <<= 8;
if ((i+2) < data.length) {
val |= (0xFF & (int) data[i+2]);
quad = true;
}
out[index+3] = alphabet[(quad? (val & 0x3F): 64)];
val >>= 6;
out[index+2] = alphabet[(trip? (val & 0x3F): 64)];
val >>= 6;
out[index+1] = alphabet[val & 0x3F];
val >>= 6;
out[index+0] = alphabet[val & 0x3F];
}
return out;
}

/**
 * Decodes a BASE-64 encoded stream to recover the original
 * data. White space before and after will be trimmed away,
 * but no other manipulation of the input will be performed.
 *
 * As of version 1.2 this method will properly handle input
 * containing junk characters (newlines and the like) rather
 * than throwing an error. It does this by pre-parsing the
 * input and generating from that a count of VALID input
 * characters.
 **/
static public byte[] decode(char[] data)
{
// as our input could contain non-BASE64 data (newlines,
// whitespace of any sort, whatever) we must first adjust
// our count of USABLE data so that...
// (a) we don't misallocate the output array, and
// (b) think that we miscalculated our data length
// just because of extraneous throw-away junk

int tempLen = data.length;
for( int ix=0; ix<data.length; ix++ )
{
if( (data[ix] > 255) || codes[ data[ix] ] < 0 )
--tempLen;// ignore non-valid chars and padding
}
// calculate required length:
//-- 3 bytes for every 4 valid base64 chars
//-- plus 2 bytes if there are 3 extra base64 chars,
// or plus 1 byte if there are 2 extra.

int len = (tempLen / 4) * 3;
if ((tempLen % 4) == 3) len += 2;
if ((tempLen % 4) == 2) len += 1;

byte[] out = new byte[len];



int shift = 0; // # of excess bits stored in accum
int accum = 0; // excess bits
int index = 0;

// we now go through the entire array (NOT using the 'tempLen' value)
for (int ix=0; ix<data.length; ix++)
{
int value = (data[ix]>255)? -1: codes[ data[ix] ];

if ( value >= 0 ) // skip over non-code
{
accum <<= 6;// bits shift up by 6 each time thru
shift += 6; // loop, with new bits being put in
accum |= value; // at the bottom.
if ( shift >= 8 ) // whenever there are 8 or more shifted in,
{
shift -= 8; // write them out (from the top, leaving any
out[index++] =// excess at the bottom for next iteration.
(byte) ((accum >> shift) & 0xff);
}
}
// we will also have skipped processing a padding null byte ('=') here;
// these are used ONLY for padding to an even length and do not legally
// occur as encoded data. for this reason we can ignore the fact that
// no index++ operation occurs in that special case: the out[] array is
// initialized to all-zero bytes to start with and that works to our
// advantage in this combination.
}

// if there is STILL something wrong we just have to throw up now!
if( index != out.length)
{
throw new Error("Miscalculated data length (wrote " + index + " instead of " + out.length + ")");
}

return out;
}


//
// code characters for values 0..63
//
static private char[] alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
.toCharArray();

//
// lookup table for converting base64 characters to value in range 0..63
//
static private byte[] codes = new byte[256];
static {
for (int i=0; i<256; i++) codes[i] = -1;
for (int i = 'A'; i <= 'Z'; i++) codes[i] = (byte)( i - 'A');
for (int i = 'a'; i <= 'z'; i++) codes[i] = (byte)(26 + i - 'a');
for (int i = '0'; i <= '9'; i++) codes[i] = (byte)(52 + i - '0');
codes['+'] = 62;
codes['/'] = 63;
}




///////////////////////////////////////////////////
// remainder (main method and helper functions) is
// for testing purposes only, feel free to clip it.
///////////////////////////////////////////////////

public static void main(String[] args)
{
boolean decode = false;

if (args.length == 0) {
System.out.println("usage:java Base64 [-d[ecode]] filename");
System.exit(0);
}
for (int i=0; i<args.length; i++) {
if ("-decode".equalsIgnoreCase(args[i])) decode = true;
else if ("-d".equalsIgnoreCase(args[i])) decode = true;
}

String filename = args[args.length-1];
File file = new File(filename);
if (!file.exists()) {
System.out.println("Error:file '" + filename + "' doesn't exist!");
System.exit(0);
}

if (decode)
{
char[] encoded = readChars(file);
byte[] decoded = decode(encoded);
writeBytes(file, decoded);
}
else
{
byte[] decoded = readBytes(file);
char[] encoded = encode(decoded);
writeChars(file, encoded);
}
}

private static byte[] readBytes(File file)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try
{
InputStream fis = new FileInputStream(file);
InputStream is = new BufferedInputStream(fis);
int count = 0;
byte[] buf = new byte[16384];
while ((count=is.read(buf)) != -1) {
if (count > 0) baos.write(buf, 0, count);
}
is.close();
}
catch (Exception e) { e.printStackTrace(); }

return baos.toByteArray();
}

private static char[] readChars(File file)
{
CharArrayWriter caw = new CharArrayWriter();
try
{
Reader fr = new FileReader(file);
Reader in = new BufferedReader(fr);
int count = 0;
char[] buf = new char[16384];
while ((count=in.read(buf)) != -1) {
if (count > 0) caw.write(buf, 0, count);
}
in.close();
}
catch (Exception e) { e.printStackTrace(); }

return caw.toCharArray();
}

private static void writeBytes(File file, byte[] data) {
try {
OutputStream fos = new FileOutputStream(file);
OutputStream os = new BufferedOutputStream(fos);
os.write(data);
os.close();
}
catch (Exception e) { e.printStackTrace(); }
}

private static void writeChars(File file, char[] data) {
try {
Writer fos = new FileWriter(file);
Writer os = new BufferedWriter(fos);
os.write(data);
os.close();
}
catch (Exception e) { e.printStackTrace(); }
}
///////////////////////////////////////////////////
// end of test code.
///////////////////////////////////////////////////

}

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

国产午夜成人免费看片无遮挡_日本免费xxxx色视频_免费人成网上在线观看_黄网址在线永久免费观看

  • <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        麻豆精品蜜桃视频网站| 久久综合网色—综合色88| 国产中文一区二区三区| 国产酒店精品激情| 91网站在线观看视频| 欧美日韩国产高清一区二区三区 | 欧美性xxxxx极品少妇| 欧美日韩国产免费一区二区| 欧美一区二区三区不卡| 国产日本欧洲亚洲| 亚洲国产aⅴ成人精品无吗| 麻豆91在线看| 91福利社在线观看| 久久久久久久久久久久久女国产乱 | 久久精品噜噜噜成人av农村| 成人精品亚洲人成在线| 69堂国产成人免费视频| 国产精品久久精品日日| 久久精品久久久精品美女| 一本一道波多野结衣一区二区| 欧美xxxxx裸体时装秀| 亚洲影视在线播放| 成人国产精品免费| 日韩小视频在线观看专区| 亚洲男人天堂av网| 国产精品综合一区二区三区| 欧美肥妇free| 亚洲在线视频免费观看| 99麻豆久久久国产精品免费优播| 欧美不卡123| 午夜精品影院在线观看| 91丨九色丨尤物| 欧美激情一区二区三区全黄| 久久精品免费观看| 欧美剧在线免费观看网站 | 欧美电影免费观看高清完整版 | 亚洲视频综合在线| 国产高清亚洲一区| 精品久久久久久久一区二区蜜臀| 青娱乐精品在线视频| 欧美揉bbbbb揉bbbbb| 亚洲私人黄色宅男| 91天堂素人约啪| 成人免费一区二区三区视频| 国产高清不卡二三区| 精品成人佐山爱一区二区| 奇米精品一区二区三区在线观看| 欧美中文字幕一区二区三区| 亚洲欧美偷拍三级| 色综合久久久久综合| 中文字幕亚洲成人| av在线一区二区三区| 国产精品视频看| 粗大黑人巨茎大战欧美成人| 中文字幕第一页久久| 国产sm精品调教视频网站| 久久久久久久久久久黄色| 老司机精品视频一区二区三区| 日韩欧美一二区| 国产在线视视频有精品| 精品1区2区在线观看| 国产精品99久久久久久久女警| 久久九九久久九九| 国产1区2区3区精品美女| 国产人妖乱国产精品人妖| 国产99久久久国产精品潘金| 国产精品网站在线播放| 色综合一区二区三区| 亚洲午夜私人影院| 日韩视频中午一区| 国产成人在线免费| 亚洲免费av网站| 7777精品伊人久久久大香线蕉完整版 | 欧美视频在线一区二区三区| 三级在线观看一区二区| 日韩亚洲欧美一区| 国产成人亚洲精品青草天美| 亚洲欧美日韩在线| 欧美女孩性生活视频| 久久疯狂做爰流白浆xx| 国产丝袜美腿一区二区三区| av在线这里只有精品| 午夜一区二区三区视频| 精品久久久久久亚洲综合网| 99久久婷婷国产综合精品电影 | 成人免费高清在线| 亚洲已满18点击进入久久| 日韩一区二区三区三四区视频在线观看 | 日韩高清不卡一区二区三区| 久久综合久久久久88| 99re这里只有精品首页| 午夜精品影院在线观看| 久久久精品国产免大香伊| 色婷婷精品大在线视频| 免费观看日韩av| 国产精品久久久久桃色tv| 欧美日韩电影在线| 国产suv精品一区二区6| 日韩精品国产精品| 日韩一区在线看| 欧美一级电影网站| 99久久免费精品高清特色大片| 日韩电影免费在线| 国产精品久久久久久久第一福利 | 精品国产乱码久久久久久1区2区 | av在线不卡网| 美女视频黄免费的久久| 国产精品亲子伦对白| 91精品国产综合久久久久| aaa欧美日韩| 国产精品原创巨作av| 亚洲va天堂va国产va久| 亚洲欧美在线另类| 久久精品这里都是精品| 91麻豆精品国产91久久久资源速度| jlzzjlzz亚洲女人18| 国产在线乱码一区二区三区| 天天影视网天天综合色在线播放| 国产精品亲子伦对白| 久久欧美一区二区| 欧美一区二区视频在线观看2022| 97超碰欧美中文字幕| 国产精品18久久久久久久久| 美国欧美日韩国产在线播放| 亚洲成av人在线观看| 亚洲免费av网站| 最新欧美精品一区二区三区| 国产日韩欧美麻豆| 久久久五月婷婷| 欧美mv日韩mv| 日韩精品专区在线影院观看| 91精品国产综合久久小美女| 欧美日韩一区 二区 三区 久久精品 | 一区二区三区中文免费| 国产精品区一区二区三| 中文字幕一区二区三中文字幕| 国产日韩欧美一区二区三区综合| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 99在线精品观看| 成人激情小说乱人伦| 国产精品一区二区在线看| 国产综合色在线| 国产精品69毛片高清亚洲| 成人午夜电影久久影院| 国产成人av电影在线观看| 粉嫩嫩av羞羞动漫久久久| 成人动漫一区二区在线| 97精品久久久久中文字幕| 91久久一区二区| 欧美色图在线观看| 欧美日韩视频专区在线播放| 欧美三级三级三级爽爽爽| 欧美日韩1234| 精品少妇一区二区三区免费观看 | 久久这里只精品最新地址| 精品国产污污免费网站入口| 久久综合网色—综合色88| 国产精品一区二区无线| 在线亚洲精品福利网址导航| 一本色道久久综合亚洲aⅴ蜜桃| 一本色道久久综合亚洲91 | 麻豆精品视频在线观看| 精品午夜久久福利影院| 国产精品一区二区视频| 91亚洲资源网| 3d动漫精品啪啪1区2区免费 | 欧美一级生活片| 精品国产免费人成电影在线观看四季 | 久久久国际精品| 1区2区3区欧美| 秋霞成人午夜伦在线观看| 国产99一区视频免费| 欧美亚洲免费在线一区| 精品捆绑美女sm三区| 国产精品久久久久久久久免费丝袜| 一级日本不卡的影视| 精品无人码麻豆乱码1区2区| 99久久久久久99| 日韩免费看的电影| 亚洲欧洲精品一区二区精品久久久| 亚洲妇熟xx妇色黄| 国产乱码精品一区二区三区忘忧草 | 中文欧美字幕免费| 亚洲成人资源在线| 国v精品久久久网| 777奇米成人网| 中文字幕综合网| 久久av老司机精品网站导航| 色综合久久久久综合体桃花网| 日韩免费性生活视频播放| 亚洲欧美日韩国产综合在线| 另类调教123区| 色综合天天综合网国产成人综合天 | 精品国产精品网麻豆系列 | 在线国产亚洲欧美| 精品国产一区二区三区av性色| 亚洲制服丝袜av| 97国产精品videossex| 久久影院电视剧免费观看| 亚洲高清免费观看高清完整版在线观看 |