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
, fast, high security level, the current implementation of the AES standard is the Rijndael algorithm;BLOWFISH, which uses a variable-length key, can be up to 448 bits long and runs fast;MD5: Strictly speaking is not a cryptographic algorithm, can only be said to be a digest algorithm.The following is an example of a Java implementation of
When doing docking, the service provider AES encryption through the SHA1PRNG algorithm (as long as the password, each generation of the array is the same, so can be used to do encryption and decryption key) for another time encryption, engaged for several hours, directly see the corresponding code bar, you can refer to
aesdemo.php:
Example
Copy the Code code as follows:
Require_once ('./aes.php ');$aes = new Aes ();$aes = new Aes (TRUE);//Store the encrypted string as hexadecimal$aes = new Aes (tr
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 ();$
From: http://snowolf.iteye.com/blog/380034
Next, we will introduce symmetric encryption algorithms. The most common is des data encryption algorithms.Des Des-Data Encryption Standard, which is the data encryption algorithm. It was published by IBM in 1975. The DES algorithm has three entry parameters: Key, data, and mo
) { byte[] Keyarray = convert.frombase64string (key); Convert the string output from the Testgenaesbytekey class to a byte array byte[] Toencryptarray = convert.frombase64string (todecrypt); RijndaelManaged Rdel = new RijndaelManaged (); Rdel.key = Keyarray; Rdel.mode = CIPHERMODE.ECB; Must be set to ECB rdel.padding = PADDINGMODE.PKCS7; Must be set to PKCS7 icryptotransform ctransform = Rdel.createdecryptor ();
as encryption)"); Encoderules=Scanner.next (); System.out.println ("Please enter the content to decrypt (ciphertext):"); Content=Scanner.next (); System.out.println ("According to the input rule" +encoderules+ "decrypted plaintext is:" +SE. Aesdncode (encoderules, content)); }}Test results:using AES symmetric encryption, enter an encrypted rule using
encryption)"); Encoderules=Scanner.next (); System. out. println ("Please enter the content to decrypt (ciphertext):"); Content=Scanner.next (); System. out. println ("according to the rules entered"+encoderules+"The decrypted plaintext is:"+SE. Aesdncode (encoderules, content)); }}"Source Download" Test results:Using AES symmetric encryption, enter an encryp
"; byte[] key = Aesutil.getkeys ();//Gets the encoding of the key byte[] bytes = Aesutil.encrypt (msg,key); String sekey = base64.encodebase64urlsafestring (key);//Convert to string after re -encrypt rsautil.init (); AES key after RSA public key is encrypted String Encryptkey = Rsautil.encryptbypublickey (Sekey,rsautil.getpublickey (RSAUtil.keyMap.get ("Public_key")); /* Analog service side ///d
In actual coding, you often encounter encryption when you store a password in a database. The encryption at URL pass-through. This simply encapsulates the AES encryption algorithm in Java below.0. Import classImport Java. Security
AES Encryption
AES is a reversible encryption algorithm that encrypts the user's sensitive information.
This article does not delve into the AES principle, only focus on Java code implementation of
)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, ofb8-ofb128
Nopadding, Pkcs5padding, i
Reprint Address: Java version AES encryption algorithm
The Advanced Encryption Standard in cryptography (Advanced encryption Standard,aes), also known as Rijndael encryption, is a block
right in the entirety of the specified number of digits. Loop right shift is when the right shift, the final digital displacement to the forefront of the digital, the cycle left is the opposite. For example, the result of moving the 1-bit (decimal bit) to the right of the decimal digit 12345678 loop is 81234567, and the result of a loop-left 1-bit is 23456781.Replacementis to replace the value of one of the digits with another in accordance with the
The mobile is getting more and more fire, we in the development process, always encounter with the mobile side to deal with the scene. In order to make the data interaction more secure, we need to encrypt the data transmission. Today, we studied the encryption of several languages, and realized it. Net,java (andriod), iOS are the same set of cryptographic algorithms, the following share to everyone.AES
The following is a commonly available online Java AES encryption and decryption method.Because it uses keygenerator and securerandom, there are no 2 classes in. NET. Cannot generate key using secure random number.After we receive the AES encrypted string sent by Java, there
. The instantaneous value is connected with the counter and then encrypted to produce a key block of the key stream, followed by an XOR operation.Advantages: Do not divulge clear text, only need to implement cryptographic functions, no padding, parallel computing.Disadvantage: the need for instantaneous value IV is difficult to guarantee the uniqueness of IV.Password feedback mode (Cipher FeedBack (CFB))Unlike the ECB and CBC modes, which can only encrypt block data, the CFB can convert block Ci
One, C # version AES encryption and decryption algorithm Public classAescode { Public stringKey {Get;Set; } Public stringEncrypt (stringval) { if(string. IsNullOrEmpty (val))return NULL;#ifCspusing(Aescryptoserviceprovider des =NewAescryptoserviceprovider ())#else using(Aesmanaged des =Newaesmanaged ())#endif { byte[] Inputbytearray =Encoding.UTF8.GetBytes
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.