开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 1.4K

javaalpha/DocSys

forked from Rainy/DocSys
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
标签 (164)
master
devInt
DocSys_V2.02.36
DocSys_V2.02.35
DocSys_V2.02.34
DocSys_V2.02.33
DocSys_V2.02.32
DocSys_V2.02.31
DocSys_V2.02.30
DocSys_V2.02.29
DocSys_V2.02.28
DocSys_V2.02.27
DocSys_V2.02.26
DocSys_V2.02.25
DocSys_V2.02.24
DocSys_V2.02.23
DocSys_V2.02.22
DocSys_V2.02.21
DocSys_V2.02.20
DocSys_V2.02.19
DocSys_V2.02.18
DocSys_V2.02.17
master
分支 (2)
标签 (164)
master
devInt
DocSys_V2.02.36
DocSys_V2.02.35
DocSys_V2.02.34
DocSys_V2.02.33
DocSys_V2.02.32
DocSys_V2.02.31
DocSys_V2.02.30
DocSys_V2.02.29
DocSys_V2.02.28
DocSys_V2.02.27
DocSys_V2.02.26
DocSys_V2.02.25
DocSys_V2.02.24
DocSys_V2.02.23
DocSys_V2.02.22
DocSys_V2.02.21
DocSys_V2.02.20
DocSys_V2.02.19
DocSys_V2.02.18
DocSys_V2.02.17
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
标签 (164)
master
devInt
DocSys_V2.02.36
DocSys_V2.02.35
DocSys_V2.02.34
DocSys_V2.02.33
DocSys_V2.02.32
DocSys_V2.02.31
DocSys_V2.02.30
DocSys_V2.02.29
DocSys_V2.02.28
DocSys_V2.02.27
DocSys_V2.02.26
DocSys_V2.02.25
DocSys_V2.02.24
DocSys_V2.02.23
DocSys_V2.02.22
DocSys_V2.02.21
DocSys_V2.02.20
DocSys_V2.02.19
DocSys_V2.02.18
DocSys_V2.02.17
DocSys
/
src
/
util
/
ISOUtil.java
DocSys
/
src
/
util
/
ISOUtil.java
ISOUtil.java 4.62 KB
一键复制 编辑 原始数据 按行查看 历史
zju_rain 提交于 2017年09月28日 11:12 +08:00 . DocSys First Version
package util;
import java.util.Arrays;
import java.util.BitSet;
public class ISOUtil {
private static ISOUtil _util = null;
private ISOUtil() {
super();
}
public static ISOUtil getInstance(){
if(_util == null)
_util = new ISOUtil();
return _util;
}
public String leftPad(String s, int length, char c){
StringBuffer buf = new StringBuffer();
for(int i=0;i < length - s.length();i++)
{
buf.append(c);
}
buf.append(s);
return buf.toString();
}
public String rightPad(String s, int length, char c){
StringBuffer buf = new StringBuffer();
buf.append(s);
for(int i=0; i< length ;i++)
{
buf.append(c);
}
return buf.toString();
}
/**
* 按位异或
* @param op1
* @param op2
* @return
*/
public byte[] xor (byte[] op1, byte[] op2) {
byte[] result = null;
if (op2.length > op1.length) {
result = new byte[op1.length];
}
else {
result = new byte[op2.length];
}
for (int i = 0; i < result.length; i++) {
result[i] = (byte)(op1[i] ^ op2[i]);
}
return result;
}
/**
* 字符串转 BCD 码
* @param s
* @param padLeft
* @param d
* @param offset
* @return
*/
public byte[] str2bcd(String s, boolean padLeft, byte[] d, int offset) {
int len = s.length();
int start = (((len & 1) == 1) && padLeft) ? 1 : 0;
for (int i=start; i < len+start; i++)
d [offset + (i >> 1)] |= (s.charAt(i-start)-'0') << ((i & 1) == 1 ? 0 : 4);
return d;
}
public byte[] str2bcd(String s, boolean padLeft) {
int len = s.length();
byte[] d = new byte[ (len+1) >> 1 ];
return str2bcd(s, padLeft, d, 0);
}
public byte[] str2bcd(String s, boolean padLeft, byte fill) {
int len = s.length();
byte[] d = new byte[ (len+1) >> 1 ];
Arrays.fill (d, fill);
int start = (((len & 1) == 1) && padLeft) ? 1 : 0;
for (int i=start; i < len+start; i++)
d [i >> 1] |= (s.charAt(i-start)-'0') << ((i & 1) == 1 ? 0 : 4);
return d;
}
public String bcd2str(byte[] b, int offset, int len, boolean padLeft)
{
StringBuffer d = new StringBuffer(len);
int start = (((len & 1) == 1) && padLeft) ? 1 : 0;
for (int i=start; i < len+start; i++) {
int shift = ((i & 1) == 1 ? 0 : 4);
char c = Character.forDigit (
((b[offset+(i>>1)] >> shift) & 0x0F), 16);
if (c == 'd')
c = '=';
d.append (Character.toUpperCase (c));
}
return d.toString();
}
public String hex2str(byte[] b) {
StringBuffer d = new StringBuffer(b.length * 2);
for (int i=0; i<b.length; i++) {
char hi = Character.forDigit ((b[i] >> 4) & 0x0F, 16);
char lo = Character.forDigit (b[i] & 0x0F, 16);
d.append(Character.toUpperCase(hi));
d.append(Character.toUpperCase(lo));
}
return d.toString();
}
public String hex2str(byte[] b, int offset, int len) {
StringBuffer d = new StringBuffer(len * 2);
for (int i=offset; i< offset + len; i++) {
char hi = Character.forDigit ((b[i] >> 4) & 0x0F, 16);
char lo = Character.forDigit (b[i] & 0x0F, 16);
d.append(Character.toUpperCase(hi));
d.append(Character.toUpperCase(lo));
}
return d.toString();
}
public byte[] str2hex (String s) {
if (s.length() % 2 == 0) {
return hex2byte (s.getBytes(), 0, s.length() >> 1);
} else {
throw new RuntimeException("Uneven number("+s.length()+") of hex digits passed to hex2byte.");
}
}
public byte[] hex2byte (byte[] b, int offset, int len) {
byte[] d = new byte[len];
for (int i=0; i<len*2; i++) {
int shift = i%2 == 1 ? 0 : 4;
d[i>>1] |= Character.digit((char) b[offset+i], 16) << shift;
}
return d;
}
public BitSet byte2BitSet (byte[] b, int offset)
{
int len = 64;
BitSet bmap = new BitSet (len);
for (int i=0; i<len; i++) {
if (((b[offset + (i >> 3)]) & (0x80 >> (i % 8))) > 0)
bmap.set(i+1);
}
return bmap;
}
public byte[] bitSet2byte(BitSet bitmap)
{
int len = (((bitmap.length()+62)>>6)<<6);
byte[] d = new byte[len >> 3];
for (int i=0; i<len; i++)
if (bitmap.get(i+1))
d[(i >> 3)] |= (0x80 >> (i % 8));
if (len>64)
d[0] |= 0x80;
return d;
}
/**
* algo 3 MAC���� ANSIX9.19��׼�㷨,����POSǩ��
* @param mackey MAC ��Կ
* @param content ����
* @return
* @throws CSException
* @throws Exception
*/
public byte[] ANSI_9_1_9_4SIGN(byte[] data, int offset, int length){
byte[] mac = new byte[8];
byte[] wdata = new byte[8];
for(int i=offset;;){
if(i+8<(length + offset)){
System.arraycopy(data, i, wdata, 0, 8);
mac = xor(mac, wdata);
i += 8;
}
else{
wdata = new byte[8];
System.arraycopy(data, i, wdata, 0, (length+offset) - i);
mac = xor(mac, wdata);
break;
}
}
return mac;
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

MxsDoc是基于Web的文件管理系统,支持权限管理、历史版本管理、Office预览/编辑、WPS预览/编辑、在线解压缩、文件分享、文件加密、远程存储、远程文件推送、秒传、断点续传、智能搜索、文件备注、自动备份、一键迁移。 主要应用场景:文件管理系统、协同办公系统、电子书、知识管理系统、软件接口管理系统、自动备份软件、网页版SVN仓库、网页版GIT仓库。GPL 2.0开源协议.
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/javaalpha/DocSys.git
git@gitee.com:javaalpha/DocSys.git
javaalpha
DocSys
DocSys
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /