Code Monkey home page Code Monkey logo

encryptdecodetool's Introduction

EncryptDecodeTool

密码+pbkdf2_hmac盐+用户ID ,AES,base64,3DES加解密工具

  1. 先将密码使用pbkdf2_hmac算法, 哈希算法为 SHA256, 盐为用户id, 次数为1000000 得到十六进制的字符串,截取前32位 为 key
  2. 使用步骤1 得到的密钥,用AES 加密算法, CBC 模式, PCKS5PADDING 填充模式, iv 取 秘钥 的前16位 加密要传送的json数据
  3. 将加密的得到的bytes进行base64编码得到加密后文本
/**
 输入原始内容,输出加密的内容
 @param originText 原内容
 @param pwd 密码
 @param salt 盐
 @return 密文
 */
+ (NSString *)CryText:(NSString *)originText pwd:(NSString *)pwd salt:(NSString *)salt;
/**
 解密
 @param secText 密文
 @param pwd 密码
 @param salt 盐
 @return 原始文
 */
+ (NSString *)deCryText:(NSString *)secText pwd:(NSString *)pwd salt:(NSString *)salt;
//先base64编码---->3DES加密---->再base64编码
+ (NSString *)encrypt3DES:(NSString *)plainText key:(NSString *)key;
//先base64解码--->3DES解密------->base64解码
+ (NSString *)decrypt3DES:(NSString *)base64text key:(NSString *)key;

encryptdecodetool's People

Contributors

kssss avatar ted-ddt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.