Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6896815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:05:28+00:00 2026-05-27T07:05:28+00:00

here’s the case i have a php script that’s using aes256 ,CBC the both

  • 0

here’s the case i have a php script that’s using aes256 ,CBC
the both key and IV size are 32 bytes long

data= '123456789abcdef' 
from Crypto.Cipher import AES
a = AES.new('oqufXQ(?bc=6_hR2I3sMZChDpb6dDlw4',2,'fOaiIOkD8*9Xeu_s4_bb87Ox_UG+D9GA')
print a.encrypt(data)

and the error i got

<type 'exceptions.ValueError'>: IV must be 16 bytes long
Traceback (most recent call last):
  File "/base/data/home/apps/s~xxxxxxx/1.155074369696961822/main.py", line 4, in <module>

php code that works

 echo base64_encode(encrypt('0123456789abcdef'))  ;


 function encrypt($data)
  {
    return mcrypt_encrypt(MCRYPT_RIJNDAEL_256 ,'oqufXQ(?bc=6_hR2I3sMZChDpb6dDlw4', $data , MCRYPT_MODE_CBC, utf8_encode('fOaiIOkD8*9Xeu_s4_bb87Ox_UG+D9GA') );
  }

I cant change the IV size

Note that I am Not very Familiar With Python, Just Need a way to encrypt data as it will be one appengine .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:05:28+00:00Added an answer on May 27, 2026 at 7:05 am

    Aha!

    There’s a difference of opinion what the “256” refers to.

    AES has a fixed block size of 128 bits, so “AES 256” means 128 bit blocks, 256 bit key, 14 rounds.

    However, Rijndael allows both the key size and the block size to vary. MCRYPT_RIJNDAEL_256 refers to Rijndael with block size set to 256 (and I don’t know how many rounds). So it does indeed take a 32 byte IV. Your PHP script is not using AES 256.

    This is confirmed in https://bugs.php.net/bug.php?id=47125 — the reporter considers it a bug in PHP mcrypt, PHP considers it a bug in libmcrypt, but it’s not a bug, since libmcrypt does document what MCRYPT_RIJNDAEL_256 means (at least the linux man page for mcrypt does, my Google-fu has failed to find any actual documentation for libmcrypt). That thing happens not to be the same as what AES 256 means.

    So, you’re encrypting and decrypting with ciphers that although related, might as well be completely different.

    The bad news is that there doesn’t appear to be a Crypto.Cipher.RIJNDAEL in PyCrypto. If you can pass a 256-bit key to MCRYPT_RIJNDAEL_128 in the PHP script, then that would be AES 256 (thanks Paŭlo).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here's a strange question for you guys, I have a nice sorted list that
Here is my code (Say we have a single button on the page that
Here is what I am trying to achieve in PHP: I have this string:
Here's the scenario: I have a local git repository that mirrors the contents of
Here's the problem....I have three components...A Page that contains a User Control and a
Here's the situation, i want to have a user that can enter time on
Here is my problem...I have a page that loads a list of clients and
Here is my situation: I am using telerik with winform. I have a dataset

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.