package base64;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
/**
* Base64是MIME邮件中常用的编码之一。
* 编码方法:从输入数据流中每次取6bit, 将此6bit的值(0~63)作为索引去查表,输出相应字符。
* 每3个字节将编码为4个字符(3x8=4x6);不满4个字符的以‘=’填充
*/
@SuppressWarnings("unused")
public class Base64 {
public static final boolean ENCODE = true;//加密
public static final boolean DECODE = false;//触密
private static final int MAX_LINE_LENGTH = 76;//每行最大字符数
private static final byte EQUALS_SIGN = 61;//==
private static final byte NEW_LINE = 10;
private static final byte BAD_ENCODING = -9;//退格
private static final byte WHITE_SPACE_ENC = -5;//空格
private static final byte EQUALS_SIGN_ENC = -1;//==
private static final byte ALPHABET[] = {
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 43, 47
};
private static final byte DECODABET[] = {
-9, -9, -9, -9, -9, -9, -9, -9, -9, -5,
-5, -9, -9, -5, -9, -9, -9, -9, -9, -9,
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
-9, -9, -5, -9, -9, -9, -9, -9, -9, -9,
-9, -9, -9, 62, -9, -9, -9, 63, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, -9, -9,
-9, -1, -9, -9, -9, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, -9, -9, -9, -9, -9, -9, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, -9, -9, -9, -9
};
/**
* 读取Base64编码的数
*/
public static class InStream extends FilterInputStream {
private boolean encode;//是否编码
private int position;//buffer中的位置
private byte[] buffer;//保存转换后的数据
private int bufferLength;//buffer的长度(3或4)
private int numSigBytes;//buffer中有效字节的长度
private int lineLength;//一行的字符数
private boolean breakLines;//是否换行
/**
* 构造一个解码模式的类对象
*/
public InStream(InputStream in) {
this(in, Base64.ENCODE);
}
/**
* 根据encode参数判断该对象采用的模式
*/
public InStream(InputStream in, boolean encode) {
this(in, encode, true);
}
/**
* breakLines参数限定每行字符数
*/
public InStream(InputStream in, boolean encode, boolean breakLines) {
super(in);
this.breakLines = breakLines;
this.encode = encode;
this.bufferLength = encode ? 4 : 3;
this.buffer = new byte[bufferLength];
this.position = -1;
this.lineLength = 0;
}
/**
* 从输入流读取足够的数据进行Base64规范的编码或解码,并且返回下一个字节
*/
public int read() throws IOException {
if(position < 0) {//如果数据不存在
if(encode) {
byte[] b3 = new byte[3];
int numBinaryBytes = 0;
for(int i=0; i<3; i++) {//编码,读取3个字节
int b = in.read();
if(b >= 0) {//判断是否到流的末尾
b3[i] = (byte)b;
numBinaryBytes++;
}
}
if(numBinaryBytes > 0) {
encode3to4(b3, 0, numBinaryBytes, buffer, 0);
position = 0;
numSigBytes = 4;
} else {
return -1;
}
} else {
byte[] b4 = new byte[4];
int i = 0;
for(i=0; i<4; i++) {//解码,读取4个有效字节
int b = 0;
do{ b=in.read();}
while(b >= 0 && DECODABET[b & 0x7f] <= WHITE_SPACE_ENC);
if(b < 0) break;
b4[i] = (byte)b;
}
if(i == 4) {
numSigBytes = decode4to3(b4, 0, buffer, 0);
position = 0;
} else if(i == 0) {
return -1;
} else {
throw new IOException("无效数据");
}
}
}
if(position >= 0) {//数据已存在,读取数据
if(position >= numSigBytes) return -1;
if(encode && breakLines && lineLength >= MAX_LINE_LENGTH) {//判断数据是否超过限长
lineLength = 0;
return '\n';
} else {
lineLength ++;
int b = buffer[position++];
if(position >= bufferLength) position = -1;
return b & 0xFF;//将字节转换为unsigned类型
}
} else {
throw new IOException("无效数据");
}
}
/**
* 读取数据,直至已经读取了len个字节或流的结束
*/
public int read(byte[] dest, int off, int len) throws IOException {
int i,b;
for(i=0; i<len; i++) {
b = read();
if(b >= 0)
dest[off + i] = (byte)b;
else if(i == 0)
return -1;
else break;
}
return i;
}
}
/**
* 按照Base64编码输出数据
*/
public static class OutStream extends FilterOutputStream {
private boolean encode;
private int position;
private byte[] buffer;
private int bufferLength;
private int lineLength;
private boolean breakLines;
/**
* 构造一个编码的输出流类对象
*/
public OutStream(OutputStream out) {
this(out, Base64.ENCODE);
}
/**
* 根据encode参数判断该类对象是编码模式还是解码模式
*/
public OutStream(OutputStream out, boolean encode) {
this(out, encode, true);
}
/**
* breakLines参数限定每行字符数
*/
public OutStream(OutputStream out, boolean encode, boolean breakLines) {
super(out);
this.breakLines = breakLines;
this.encode = encode;
this.bufferLength = encode ? 3 : 4;
this.buffer = new byte[bufferLength];
this.position = 0;
this.lineLength = 0;
}
/**
* 转化完成后,将字节定入输出流
* 如果是编码,则对字节进行缓存,每次缓存3个字节,然后执行写操作
* 如果是解码,则每次缓存4个字节
*/
public void write(int theByte) throws IOException {
if(encode) {
buffer[position++] = (byte)theByte;
if(position >= bufferLength) {
out.write(Base64.encode3to4(buffer, bufferLength));
lineLength +=4;
if(breakLines && lineLength >= MAX_LINE_LENGTH) {
out.write(NEW_LINE);
lineLength = 0;
}
position = 0;
}
} else {
if(DECODABET[theByte & 0x7f] > WHITE_SPACE_ENC) {
buffer[position++] = (byte)theByte;
if(position >= bufferLength) {
out.write(Base64.decode4to3(buffer));
position = 0;
}
} else if(DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC) {
throw new IOException("无效数据");
}
}
}
/**
* 写入len个字节
*/
public void write(byte[] theBytes, int off, int len) throws IOException {
for(int i=0; i<len; i++) {
write(theBytes[off + i]);
}
}
/**
* 编码时,对其进行补位;
* 解码时,如果Base64规范的输入没有正确补位将会抛异常
*/
public void flush() throws IOException {
if(out != null) super.flush();
if(position > 0) {
if(encode) {
out.write(Base64.encode3to4(buffer, position));
position = 0;
} else {
throw new IOException("无效数据");
}
}
if(out != null)
out.flush();
}
/**
* 关闭并清空流
*/
public void close() throws IOException {
if(out != null) {
super.close();
out.close();
buffer = null;
out = null;
}
}
}
/**
* 对threeBytes数组的前3个字节进行编码,并且返回一个Base64规范的4-byte数组
*/
private static byte[] encode3to4(byte[] threeBytes) {
return encode3to4(threeBytes, 3);
}
/**
* threeBytes数组大小与numSigBytes相等
*/
private static byte[] encode3to4(byte[] threeBytes, int numSigBytes) {
byte[] dest = new byte[4];
encode3to4(threeBytes, 0, numSigBytes, dest, 0);
return dest;
}
/**
* 对source数组按照Base64规范进行编码,并将结果写入destination数组
* srcOffset和destOffset确定数组起点
* source数组大小必须满足srcOffset+3, destination数组大小必须满足destOffset+4
* numSigBytes指定数组中的实际有效字节数
*/
private static byte[] encode3to4(byte[] source, int srcOffset,
int numSigBytes, byte[] destination, int destOffset) {
/*
* 如果numSigBytes是1或2就创建一个用0初始化的buffer,并且向左移动24位;
* (其目的是为了将1完全清除,防止java在将一个字节转化成int型的时候,将值转化成负数)
*
* 1、左移运算符<<使指定值的所有位都左移规定的次数,规则:
* 丢弃最高位,0补最低位;
* 如果移动的位数超过了该类型的最大位数,那么编译器会对移动的位数取模
* 2、右移运算符>>使指定值的所有位都右移规定的次数,规则:
* 符号位不变,左边补上符号位;
* 3、无符号右移运算符>>> :忽略了符号位扩展,0补最高位 ;只是对32位和64位的值有意义
* 右移相当于除,左移相当于乘,左移一位乘2,左移二位乘4。。。
*/
int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) |
(numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) |
(numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0);
//根据有效的字节数进行转换
switch(numSigBytes) {
case 3:
destination[destOffset] = ALPHABET[(inBuff >>> 18)];
destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f];
destination[destOffset + 3] = ALPHABET[(inBuff) & 0x3f];
return destination;
case 2:
destination[destOffset] = ALPHABET[(inBuff >>> 18)];
destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f];
destination[destOffset + 3] = EQUALS_SIGN;
return destination;
case 1:
destination[destOffset] = ALPHABET[(inBuff >>> 18)];
destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = EQUALS_SIGN;
destination[destOffset + 3] = EQUALS_SIGN;
return destination;
default: return destination;
}
}
/**
* 对字节数组进行编码
*/
public static String encodeBytes(byte[] source) {
return encodeBytes(source, true);
}
/**
* 对字节数组进行编码
*/
public static String encodeBytes(byte[] source, boolean breakLines) {
return encodeBytes(source, 0, source.length, breakLines);
}
/**
* 对字节数组进行编码
*/
public static String encodeBytes(byte[] source, int off, int len) {
return encodeBytes(source, off, len, true);
}
/**
* 实际进行编码的方法
*/
public static String encodeBytes(byte[] source, int off, int len, boolean breakLines) {
int len43 = len * 4 / 3 , d = 0, e = 0 , len2 = len - 2, lineLength = 0;
byte[] outBuff = new byte[len43 + ((len % 3) > 0 ? 4 : 0) + (breakLines ? (len43 / MAX_LINE_LENGTH) : 0)];
for(;d < len2; d += 3, e += 4) {
encode3to4(source, d+off, 3, outBuff, e);
lineLength += 4;
if(breakLines && lineLength == MAX_LINE_LENGTH) {
outBuff[e + 4] = NEW_LINE;
e++;
lineLength = 0;
}
}
if(d < len) {
encode3to4(source, d+off, len-d, outBuff, e);
e += 4;
}
return new String(outBuff, 0, e);
}
/**
* 对String进行编码
*/
public static String encodeString(String s) {
return encodeString(s, true);
}
/**
* 对String进行编码
*/
public static String encodeString(String s, boolean breakLines) {
return encodeBytes(s.getBytes(), breakLines);
}
/**
* 按照Base64编码串行化对象Object
*/
public static String encodeobject(Serializable sobj) {
return encodeObject(sobj, true);
}
/**
* 实际串行化对象Object
*/
public static String encodeObject(Serializable sobj, boolean breakLines) {
ByteArrayOutputStream baos = null;
OutputStream b64os = null;
ObjectOutputStream oos = null;
try {
baos = new ByteArrayOutputStream();
b64os = new Base64.OutStream(baos, ENCODE, breakLines);
oos = new ObjectOutputStream(b64os);
oos.writeObject(sobj);
} catch(IOException e) {
e.printStackTrace();
return null;
} finally {
try {
oos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
b64os.close();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
baos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
return new String(baos.toByteArray());
}
/**
* 读取文件中的数据
*/
public static byte[] readFile(String file, boolean encode) {
return readFile(new File(file), encode);
}
/**
* 根据encode参数,读取文件中的数据
*/
public static byte[] readFile(File file, boolean encode) {
byte[] data = new byte[1024];//文件中的字符数不能超过1024
byte[] returnValue = null;
int nextIndex = 0;
int b = -1;
Base64.InStream bis = null;
try {
bis = new Base64.InStream(new BufferedInputStream(new FileInputStream(file)), encode);
while((b = bis.read()) >= 0) {
if(nextIndex > data.length) {//重新设定数组长度
byte[] temp = new byte[data.length << 1];
System.arraycopy(data, 0, temp, 0, data.length);//截取数组
data = temp;
}
data[nextIndex++] = (byte)b;
}
returnValue = new byte[nextIndex];
System.arraycopy(data, 0, returnValue, 0, nextIndex);
} catch (IOException e) {
returnValue = null;
} finally {
try {
if(bis != null)
bis.close();
} catch (IOException e) {
}
}
return returnValue;
}
/**
* 将字节数组写入文件
*/
public static boolean writeFile(byte[] data, String file, boolean encode) {
return writeFile(data, 0, data.length, new File(file), encode);
}
/**
* 将字节数组写入文件
*/
public static boolean writeFile(byte[] data, File file, boolean encode) {
return writeFile(data, 0, data.length, file, encode);
}
/**
* 根据encode参数,将字节数组写入文件
*/
public static boolean writeFile(byte[] data, int offset, int length, File file, boolean encode) {
Base64.OutStream bos = null;
boolean success = false;
try {
bos = new Base64.OutStream(new BufferedOutputStream(new FileOutputStream(file)), encode);
bos.write(data, offset, length);
success = true;
} catch (IOException e) {
success = false;
} finally {
try {
bos.close();
} catch (IOException e) {
}
}
return success;
}
/**
* 对文件数据进行编码,返回编码后的字符串,抛异常则返回null
*/
public static String encodeFromFile(String rawfile) {
byte[] ebytes = readFile(rawfile, ENCODE);
return ebytes == null ? null : new String(ebytes);
}
/**
* 对文件数据进行解码,返回解码后的字符串,抛异常则返回null
*/
public static byte[] decodeFromFile(String encfile) {
return readFile(encfile, DECODE);
}
/**
* 将编码后的数据写入文件
*/
public static boolean encodeToFile(byte[] rawdata, String file) {
return writeFile(rawdata, file, ENCODE);
}
/**
* 将解码后的数据写入文件
*/
public static boolean decodeToFile(byte[] encdata, String file) {
return writeFile(encdata, file, DECODE);
}
/**
* 对fourBytes数组进行解码,并返回解码后的数组
*/
private static byte[] decode4to3(byte[] fourBytes) {
byte[] outBuff1 = new byte[3];
int count = decode4to3(fourBytes, 0, outBuff1, 0);
byte[] outBuff2 = new byte[count];
for(int i=0; i<count; i++) outBuff2[i] = outBuff1[i];
return outBuff2;
}
/**
* 对fourBytes数组进行解码,并返回解码后的数组
*/
private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) {
if(source[srcOffset + 2] == EQUALS_SIGN) {
int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) |
((DECODABET[source[srcOffset + 1]] & 0xFF) << 12);
destination[destOffset] = (byte)(outBuff >>> 16);
return 1;
} else if(source[srcOffset + 3] == EQUALS_SIGN) {
int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) |
((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) |
((DECODABET[source[srcOffset + 2]] & 0xFF) << 6);
destination[destOffset] = (byte)(outBuff >>> 16);
destination[destOffset + 1] = (byte)(outBuff >>> 8);
return 2;
} else {
int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) |
((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) |
((DECODABET[source[srcOffset + 2]] & 0xFF) << 6) |
((DECODABET[source[srcOffset + 3]] & 0xFF));
destination[destOffset] = (byte)(outBuff >> 16);
destination[destOffset + 1] = (byte)(outBuff >> 8);
destination[destOffset + 2] = (byte)(outBuff);
return 3;
}
}
/**
* 对String进行解码,并返回解码后的数组
*/
public static byte[] decode(String s) {
byte[] bytes = s.getBytes();
return decode(bytes, 0, bytes.length);
}
/**
* 对String进行解码,并返回String
*/
public static String decodeToString(String s) {
return new String(decode(s));
}
/**
* 对Base64规范的数据进行解码,并且反串行化得到一个java对象
*/
public static Object decodeToObject(String encodeedObject) {
byte[] objBytes = decode(encodeedObject);
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
bais = new ByteArrayInputStream(objBytes);
ois = new ObjectInputStream(bais);
return ois.readObject();
} catch (IOException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
} finally {
try {
bais.close();
} catch (IOException e) {
}
try {
ois.close();
} catch (IOException e) {
}
}
}
/**
* 对Base64规范的数据进行解码
*/
public static byte[] decode(byte[] source, int off, int len) {
int len34 = len * 3 / 4, outBuffPosn = 0, b4Posn = 0, i = 0;
byte[] outBuff = new byte[len34];
byte[] b4 = new byte[4];
byte sbiCrop = 0;
byte sbiDecode = 0;
for(i=0; i<len; i++) {
sbiCrop = (byte)(source[i] & 0x7f);//只需要低位的7个bit
sbiDecode = DECODABET[sbiCrop];
if(sbiDecode >= WHITE_SPACE_ENC) {//空格
if(sbiDecode >= EQUALS_SIGN_ENC) {//==
b4[b4Posn++] = sbiCrop;
if(b4Posn > 3) {
outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn);
b4Posn = 0;
//如果没有"=="就跳出循环
if(sbiCrop == EQUALS_SIGN) break;
}
}
} else {
return null;
}
}
byte[] out = new byte[outBuffPosn];
System.arraycopy(outBuff, 0, out, 0, outBuffPosn);
return out;
}
}
相关推荐
RV1126上YOLOv8部署实战:从模型转换到板端推理的完整避坑指南
本文提供了在瑞芯微RV1126芯片上部署YOLOv8目标识别算法的完整实战指南。内容涵盖从模型转换、环境搭建到板端推理代码编写的全流程,重点解析了RKNN-Toolkit使用、量化配置、内存优化及后处理实现等关键环节的常见问题与解决方案,旨在帮助开发者高效避坑,实现边缘AI应用的稳定落地。
生成二维码图片并且使用BASE64编码显示到前端页面
现在用二维码传递消息是如此的流行和快捷,二维码中可存储的信息量比较大,容易识别,内容丰富,可以储存文本,链接,名片等等。并且现在支付宝微信等的支付都直接可以用扫描二维码进行支付,利用特定的扫码软件,能够解析二维码中的内容。在我的项目中,用到了需要存储一个二维码的链接,让用户直接扫码以后就可以下单的需求。经过查询,可以用Google的qrcodegencore.jar...
3.ESP32S3 AP 配网开发实战:HTTP 与 WebSocket 协议实现
本文介绍了基于ESP32S3的AP配网实现方案,通过HTTP协议提供配网网页,利用WebSocket实现双向通信。详细解析了HTTP和WebSocket协议特点,阐述了SPIFFS文件系统存储HTML网页的方法,包括分区表配置、CMakeLists设置和代码实现。工程采用模块化设计,包含WiFi管理、Web服务器、IO扩展等组件,支持手机浏览器直接配网。测试验证了从AP热点连接到路由器切换的全流程,并总结了SPIFFS操作、WebSocket通信等核心优化点。该方案无需专用APP,适合物联网设备快速部署场景
前后端通过Json&&Base64实现图片交互
通过hutool事项json传图
snipersim安装
snipersim安装记录,便于后续使用tip:snipersim需要在python2的环境下编译。
EEGLAB+ERPLAB实战:从.cnt文件到情绪ERP差异波,一份避坑指南
本文详细介绍了使用EEGLAB和ERPLAB处理Neuroscan的.cnt格式脑电数据的全流程,从数据导入、预处理到情绪ERP差异波生成。重点解决了采样率验证、事件标记检查、重参考选择、滤波策略与ICA组合等实操难题,并提供了情绪图片ERP研究中P1、EPN和LPP成分的分析技巧,帮助研究者避免常见错误,提升数据处理效率。
zxing生成二维码条形码(Base64)
maven依赖(core生成二维码,javase生成条形码,axis是base64转换): <dependency> <groupId>com.google.zxing</groupId> <artifactId>core</artifactId> <version>3.3.0</version> </dependency> <dependency> <gro
【自动驾驶学习笔记——Prescan和Simulink 学习笔记和问题记录(1)】
主要记录一些Prescan/Simulink 联合仿真出现的问题。
Java后端利用DefaultKaptcha生成验证码及校验(缓存在Redis中)
在Java后端进行验证码的生成,可实现验证码开关、缓存在Redis中。 一、设计思路 在pom文件中引入DefaultKaptcha的依赖(Jar包)。 在CaptchaConfig类中配置验证码相关的参数。 利用DefaultKaptcha实现类生成验证码图片。 利用Redis数据库对验证码进行缓存。 利用ImageIO类将验证码图片以流形式写入到内存中。 前端页面利用Img标签的src属性,根据Base64编码格式数据获取验证码图片显示。 校验时,从Redis中取出验证码并...
智能体异常行为检测-基于行为序列的异常模式识别技术【附代码】
在多智能体系统(Multi-Agent Systems, MAS)中,智能体之间的行为协调与自主决策是系统稳定运行的关键。然而,当某个智能体因策略偏移、环境变化或潜在攻击而出现**异常行为(Abnormal Behavior)**时,整个系统可能陷入混乱或崩溃。
AI穿透式智慧粮仓
本报告基于 2025-2026 年全国多地智慧粮储实践案例,系统分析了 "AI + 穿透式" 智慧粮储体系的技术架构、AI 算法应用、提质增效成效、区域差异化特点及未来发展趋势。该体系通过多模态感知、智能算法与管控平台的深度融合,实现粮食存储全流程精准感知、智能预警与科学调控,显著降低储粮损耗与运营成本,大幅提升储粮安全水平与管理效率。报告梳理了各地差异化实践路径,提出针对性发展建议,为推动我国粮食仓储高质量发展、筑牢国家粮食安全防线提供参考。
什么是Base64,以及在Java中使用Base64编码
Base64是一种用64个字符(0-9,a-z,A-Z,+,/)来表示二进制数据的方法,是基于64个可打印字符进行编码的。Base是一种索引编码,每6个bit位作为一个单元,对应一个字符,为了保证所输出的编码为可读字符,Base64制定了一个编码表,以便进行统一转换,编码表的大小为2^6=64,这也是Base64名称的由来。
11、气动外形优化中的连续伴随方法
本文探讨了连续伴随方法在气动外形优化中的理论背景、实现和验证过程。通过使用DLR的FLOWer求解器,将伴随方法应用于Euler和Navier-Stokes方程,以高效计算成本函数梯度,从而显著减少优化过程中的计算成本。文章还介绍了该方法在RAE2822翼型和ONERA M6机翼等案例中的应用,并展示了其准确性和效率。未来展望包括扩展到复杂流动模拟和多学科优化。
base64编码_Base64编码详解
来源 | 公众号 架构师必备Base64编码原理Base64编码之所以称为Base64,是因为其使用64个字符来对任意数据进行编码,同理有Base32、Base16编码。标准Base64编码使用的64个字符为:这64个字符是各种字符编码(比如ASCII编码)所使用字符的子集,基本,并且可打印。唯一有点特殊的是最后两个字符,因对最后两个字符的选择不同,Base64编码又有很多变种,...
Devexpress16.2.6破解工具
Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具
ET2012新版免狗免安装绿色软件
ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,
HEX编码、Base64编码
摘要 本文将讲述HEX 和Base64,编码的规则。 HEX编码 hex编码也称之为Base16 编码 就是把一个字节,用十六进制来表示, 表示的结果得是字符形式的。 说过程大家就会更加容易理解 比如说字符的 ‘a’,在计算机底层存储的是 0110 0001 ,对应的16进制就是61 ,它对应的字符 是'61' 也就是说 ‘a’ 经过HEX编码转化成了 '61' ,从计算存储二进制的角度是 从0110 0001经过HEX编码成了 0011 0110 0000 0001,占用的存储扩大了一倍。 其他任意
win10 跳过U8环境检测的IE WebControls.rar
win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。
base64怎么编码
换算单位 1字=2字节;1字节=8位;1位=1比特;1字=16位=16比特; 字节=Byte 比特=bit bit是表示信息的最小单位,只有两种状态:0和1 base64 base64代码对应表 base64代码范围:A-Za-z0-9+/ 26个大写字母、26个小写字母、10个数字、两个符号 26+26+10+2=64; 其实是 65 个字符, = 是填充字符; 64 个字符需..
文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况
主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。
base64编码
这是 Base64 编码所使用的标准编码表,它包含了 64 个可打印的 ASCII 字符,按照一定顺序排列,用于将二进制数据转换为对应的可打印字符形式。
【BASE64编码——编码规则】
BASE64编码。
关于Base64编码
很多朋友可能都会使用到BASE64这种编码格式,但是编码不等于加密(encoding is not encrypting),编码只是将数据进行格式化,而加密使数据具有保密性。 在编码方式的选择时,BASE64编码可以将数据转换为普通文本格式,例如X.509标准格式的证书(.cer)就可以导出为BASE64编码格式的数据,如下所示: ----BEGIN CERTIFICATE---
Openresty base64编码
OpenResty目前内建支持的有Base64和JSON两种格式,下面我们介绍base64. Base64格式使用64个字符,可以把任意数据转换为ASCII码可见字符串,应用得非常普遍。OpenResty使用ngx.encode_base64和ngx.decode_base64这两个函数实现了标准的Base64编码和解码: local str = "1234" local enc = ngx.encode_base64(str) -- 编码为“ MTizNA==” local dec= ngx
base64编码_彻底弄明白Base64 编码
Base64 encoding/decoding常见于各种authentication和防盗链的实现当中。彻底搞懂它绝对提升团队troubleshooting的底气。我们从纯手工方式编码解码开始,然后看看学到的技能怎么样应用在实际的troubleshooting 中。准备工作: 我们应知道一个byte有8个bits,并且知道怎么表示它。 我们应该comfortable with hex, bina...
Base64编码简介
Base64编码简介 基本概念 Base64这个术语最初是在“MIME内容传输编码规范”中提出的。Base64不是一种加密算法,虽然编码后的字符串看起来有点加密的赶脚。它实际上是一种“二进制到文本”的编码方法,它能够将给定的任意二进制数据转换(映射)为ASCII字符串的形式,以便在只支持文本的环境中也能够顺利地传输二进制数据。例如支持MIME的电子邮件应用,或需要在XML中存储复杂数据(例如图片)...
567



被折叠的 条评论
为什么被折叠?



