• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >ios > 下面是服务端加密的方法,ios端怎样做能得到和它一样返回的byte?

下面是服务端加密的方法,ios端怎样做能得到和它一样返回的byte?

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-06-05

佚名通过本文主要向大家介绍了ios byte,ios uiimage 转byte,byte,byte是什么意思,byte类型等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 下面是服务端加密的方法,ios端怎样做能得到和它一样返回的byte?
描述:

import java.util.ArrayList;
import java.util.List;
public class Des {
    public Des() {
    }
    public static void main(String[] args) {
        Des desObj = new Des();
        String key1 = "1";
        String key2 = "2";
        String key3 = "3";
        String data = "admin";
        String str = desObj.strEnc(data, key1, key2, key3);
        System.out.println(str);
        String dec = desObj.strDec(str, key1, key2, key3);
        System.out.println(dec);
    }
    /**
     * DES加密/解密
     * 
     * @Copyright Copyright (c) 2006
     * @author Guapo
     * @see DESCore
     */
    /*
     * encrypt the string to string made up of hex return the encrypted string
     */
    public String strEnc(String data, String firstKey, String secondKey,
            String thirdKey) {
        int leng = data.length();
        String encData = "";
        List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
        int firstLength = 0, secondLength = 0, thirdLength = 0;
        if (firstKey != null && firstKey != "") {
            firstKeyBt = getKeyBytes(firstKey);
            firstLength = firstKeyBt.size();
        }
        if (secondKey != null && secondKey != "") {
            secondKeyBt = getKeyBytes(secondKey);
            secondLength = secondKeyBt.size();
        }
        if (thirdKey != null && thirdKey != "") {
            thirdKeyBt = getKeyBytes(thirdKey);
            thirdLength = thirdKeyBt.size();
        }
        if (leng > 0) {
            if (leng < 4) {
                int[] bt = strToBt(data);
                int[] encByte = null;
                if (firstKey != null && firstKey != "" && secondKey != null
                        && secondKey != "" && thirdKey != null
                        && thirdKey != "") {
                    int[] tempBt;
                    int x, y, z;
                    tempBt = bt;
                    for (x = 0; x < firstLength; x++) {
                        tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
                    }
                    for (y = 0; y < secondLength; y++) {
                        tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
                    }
                    for (z = 0; z < thirdLength; z++) {
                        tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
                    }
                    encByte = tempBt;
                } else {
                    if (firstKey != null && firstKey != "" && secondKey != null
                            && secondKey != "") {
                        int[] tempBt;
                        int x, y;
                        tempBt = bt;
                        for (x = 0; x < firstLength; x++) {
                            tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
                        }
                        for (y = 0; y < secondLength; y++) {
                            tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
                        }
                        encByte = tempBt;
                    } else {
                        if (firstKey != null && firstKey != "") {
                            int[] tempBt;
                            int x = 0;
                            tempBt = bt;
                            for (x = 0; x < firstLength; x++) {
                                tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
                            }
                            encByte = tempBt;
                        }
                    }
                }
                encData = bt64ToHex(encByte);
            } else {
                int iterator = (leng / 4);
                int remainder = leng % 4;
                int i = 0;
                for (i = 0; i < iterator; i++) {
                    String tempData = data.s

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 下面是服务端加密的方法,ios端怎样做能得到和它一样返回的byte?

相关文章

  • 2017-06-05 如何用代码的方式使ViewControl的View继承自UIControl
  • 2017-06-05 iOS开发,如何跳转到系统设置页面。需适配iOS7-10
  • 2017-06-05 IOS开发如何实现参数化构建编译?
  • 2017-06-05 关于xcode意外退出的问题
  • 2017-06-05 iOS开发中,使用URLManager,但是在一个登陆屏幕上,点击登陆按钮后想跳转出一个没有后退按钮的navigator的View怎么弄?
  • 2017-06-05 iOSGCDAsyncSocket发送数据设置缓存大小?
  • 2017-06-05 求大神帮忙预估一下做这个网站的app大概要多少钱?安卓跟ios都要www7-mvcom,就是跟网站上的功能一样,能上传歌曲,有个人中心,ps:网站还没写
  • 2017-06-05 UITableView点击cell的时候怎么改变sectionHeader的颜色?
  • 2017-06-05 iOS下UIWebView数据显示在滑动时不更新的问题
  • 2017-06-05 张馨予露全乳删除删除怎么删除提交到cocoapods上的框架?

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • (swift)iOSApp下架
    • iOSnavigationbar的高度可以修改吗?
    • IOStextField怎样设置只能输入英文字母或者数字,不能输入汉字
    • qq信息提示音ios提示信息的轮子
    • hookdealloc方法装逼失败,咋弄了这下该如何收场
    • iOS基础控件ios声明变量提问
    • 请问下afHttp网络访问怎么添加请求头和指定sessionId
    • 关于UIButton使用setAttributedTitle:forState:之后无法改变标题颜色
    • 一个NSString的指针怎么判断是不是为null?
    • xcodearchiveXcode中有哪些特别爽的快捷键?

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有