Yesterday wrote an asymmetric data encryption, today to write symmetric data encryption AES. Symmetric data encryption is the use of only one key for encryption and decryption, AES can use 128,192, and
)AES(Advanced Encryption Standard,高级数据加密标准,AES算法可以有效抵制针对DES的攻击算法)Let's look at a simple comparison of these three algorithms:
algorithm Key
Length
default key Length
Working mode
Fill Mode
Des
56
56
ECB, CBC, PCBC, CTR, CTS, CFB, cfb8-cfb128, OFB
1. Download the Gtmbase64-master and Aescrypt-objc-master from GitHub and import the project as shown in.2. Pre-use configuration and precautions:(1) gtmbase64.m in build phases need to be set-fno-objc-arc(2) Import #import in #import "nsstring+base64.m" File (3) Add #import in the #import "gtmbase64.m" File 3. CusMD5.h and cusmd5.m files#import ---> MD5 can only be called an irreversible encryption algorithm
AES encryption algorithm-algorithm principle
The AES algorithm is based on permutation and permutation operations. The arrangement is to reschedule the data, and the permutation is to replace one data unit with another.
how AES can be incorporated into your software system and why, and how to test AES based software.
Note that the code provided in this article and any other implementations based on this article are within the scope of application of the Federal Cryptographic module export control (see Commercial encryption Export Controls for details).
Put the code first. There are two files: AES. php (aes algorithm file) and aesDemo. php (application instance file) aesDemo. php:
Example,
The Code is as follows:
Require_once ('./AES. php ');// $ Aes = new AES ();$
Use default encryptionpublic static string Desencrypt (String strText)Use default decryptionpublic static string Desdecrypt (String strText)Encrypt the string, note that the length of the Strencrkey is 8 bitspublic static string Desencrypt (String strText, String strencrkey)Decrypt the string, note that the length of the Strencrkey is 8 bitspublic static string Desdecrypt (String strText, String sdecrkey)Encrypt the data file, note that the length of the Strencrkey is 8 bitspublic static void De
Today in the Android project using AES to decrypt the data, encountered a lot of problems, the Internet also found a lot of information, also not. But finally let me get out, here to record this, do not let others go my detour, because most of the online example is not feasible. Okay, let's start with the explanation.
1, AES Tool class
Package com.example.cheng.aesencrypt;
Import Android.text.TextUti
* * about the use of AES encryption and SHA256 encryption used in IOS development
**The author in the previous period of time on this issue with the background of the docking of people, and finally finally determine the problem is our encryption, although all for the same species, but there are essential differences. B
addition to improving the hardware function and increasing the parallel processing function, the DES algorithm's encryption strength can not be improved from the algorithm itself and software technology.Compared with DES algorithm, the AES algorithm solves the above problem
The aes encryption algorithm in java is as follows: {code...} How can I use php to implement? I have tested many online examples and cannot obtain the same ciphertext. the aes encryption algorithm in java is as follows:
publi
AES encryption and decryption algorithm, using BASE64 to do transcoding and auxiliary encryption: package Com.wintv.common;Import Javax.crypto.Cipher;Import Javax.crypto.spec.IvParameterSpec;Import Javax.crypto.spec.SecretKeySpec;Import Sun.misc.BASE64Decoder;Import Sun.misc.BASE64Encoder;/** **************************
Python AES encryption and decryption, and pythonaes encryption and decryption
The length of the AES encrypted data block group must be 128 bits, and the key length can be any of the 128 bits, 192 bits, and 256 bits (if the length of the data block and the key is insufficient
. Decrypt the encrypted content/public static string Aesdncode ( String encoderules,string content) {try {//1. Construct key builder, specified as AES algorithm, case-insensitive Keygenerator keygen=keygenerator.get
Instance ("AES"); 2. Generate a 128-bit random source based on the Ecnoderules rule initialization key generator/, according to the passed-in b
. Me ');Var_dump ($ aes-> decrypt ($ c ));
Example: an encryption and decryption class
The code is as follows:
/*** AES encryption and decryption* @ Author hushangming** Usage:*
* // Instantiate the class* // Parameter $ _ bit: format, which can be 256, 192, or 128 byte
AES (Encryption Standard, Chinese: Advanced Encryption Standard), is a block encryption standards. AES is processed by dividing the raw data into multiple 4x4 byte matrices, with a pre-defined key that makes each byte in each byte matrix XOR, replaced, shifted, and linearly
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.