Note that there are some explanatory texts on larger screens.

plurals
  1. POHow iphone crypt AES256 output 32 Byte Hex String?
    primarykey
    data
    text
    <p>Dear Gurus, I have code on java with bouncy castle lib, like this :</p> <pre><code>private static String AES (boolean encrypt, String inputString, String keyString) { byte [] input, cipherText; int outputLen; BufferedBlockCipher cipher = new BufferedBlockCipher(new AESEngine()); input = HexString.hexToBytes(inputString); cipher.init (encrypt, new KeyParameter (HexString.hexToBytes(keyString))); cipherText = new byte[cipher.getOutputSize(input.length)]; outputLen = cipher.processBytes( input, 0, input.length, cipherText, 0); try { cipher.doFinal (cipherText, outputLen); } catch (DataLengthException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidCipherTextException e) { // TODO Auto-generated catch block e.printStackTrace(); } return HexString.bytesToHex(cipherText); } </code></pre> <p>this output methode like this :</p> <p>screet : 6a7573742074657374696e6700000000</p> <p>key : 6f2ca4106748c1eaeff88bdad4049285</p> <p>Result : f1ecd6bc3109b1f2355be3a32dd49874</p> <p>and this is my code on IOS :</p> <pre><code>NSLog( @"Screet : %@", secret ); NSLog( @"Key : %@", key ); NSString *encryptedString = [secret AES256EncryptWithKey:key]; NSLog( @"Result : %@", encryptedString ); NSLog( @"Result Hex : %@", [NSString stringToHex:encryptedString] ); </code></pre> <p>Screet : 6a7573742074657374696e6700000000</p> <p>Key : 6f2ca4106748c1eaeff88bdad4049285</p> <p>Result : UBXp6lFnM+XAZvVeOuYkI/T4+brXyGBmzGOUMO+XrGS8MWGDVb0RrZGBHyw2l2Ml</p> <p>Result Hex : 55425870366c466e4d2b58415a7656654f75596b492f54342b6272587947426d7a474f554d4f2b58724753384d57474456623052725a4742487977326c324d6c</p> <p>I use NSData+AESCrpt from this forum. is there any suggestion that in order the result is same ios and java (32 Byte on String) ? Thanks for gurus help :).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload