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 6354441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:34:35+00:00 2026-05-24T22:34:35+00:00

I have to encrypt a piece of text using Ruby. I’ve used the Ruby-Openssl

  • 0

I have to encrypt a piece of text using Ruby. I’ve used the Ruby-Openssl gem for that purpose. This encrypted text is them passed to a python program using which I have to decrypt it. I’ve used Pycrypto for the purpose.

The problem is, in Pycrypto we have to specify the padding convention manually. In Ruby, the padding is done automatically. I’m using AES-CBC block cipher mode. This padding causes problems as its stripping cannot be performed properly in Python. As an example, these are the base64 encodings of an encrypted text in both Ruby and Python:

Python: aENJY28lvE89yY2T/te8vWwdeoeSqSwwlrOAv7b3AWw=
Ruby:   aENJY28lvE89yY2T/te8vVoQE6JNxdSRgYXC8mqF3nI=

Please help…

  • 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-24T22:34:36+00:00Added an answer on May 24, 2026 at 10:34 pm

    OpenSSL applies PKCS#5Padding by default, so this is also used automatically when encrypting data with OpenSSL::Cipher in AES-CBC mode (cf. OpenSSL docs). So there’s no need to perform manual padding when using Ruby.

    The padding has to be done manually in Python when using PyCrypto.

    Once you apply this padding scheme in Python, both encrypted Base64 strings should match.

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

Sidebar

Related Questions

I have some code to encrypt some strings in Python. Encrypted text is used
I have a .bmp image. I wanted to encrypt the image file using openssl
I have used the crypt function in c to encrypt the given string. I
I have a program in C++ that uses the cryptopp library to decrypt/encrypt messages.
Does anyone know do there have any way that I can encrypt the array
Is there a way to encrypt the data file that mysql uses? I have
This is regarding AES algorithm. Suppose i have implemented a AES algorithm and encrypt
I have a query string I need to encrypt using AES in CBC mode
I have an App that will send authenticated emails using System.Net.Mail and System.Net.NetworkCredential my
Hi All I have to encrypt my data using Blowfish algorithm in C++...can you

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.