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

  • SEARCH
  • Home
  • 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 7890875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:28:14+00:00 2026-06-03T06:28:14+00:00

I am writing application that encrypts photos and though it need decrypt and show

  • 0

I am writing application that encrypts photos and though it need decrypt and show thumbnails in gallery like activity. Then of course you can click and see full sized image in different activity.
I am using AES/CBC/PKCS7Padding cipher with 256 bit key. I derive cipher key using PBEWithSHA256And256BitAES-CBC-BC and store it into memory. Then all threads that need to make encryption/decryption is using that key from memory initializing Cipher object with it.

So here is my problem. When I decrypt many images simultaneously (let’s say I need to show up gallery) and after I try to decrypt full sized image, it’s extremely slow. On the other hand if I decrypt just one image (no matter what size), then go to gallery then decrypt full size image it is very fast.

I am really confused.

So what I am doing wrong? Maybe Bouncy Castle Crypto library is not thread safe?

UPDATE: I’ve found out this problem is related to JIT. Disabling JIT totally eliminates any processing speed difference. Can anyone help to understand how to optimize code to force JIT compile right part of the code when decrypting photos with multithreading to gain same speed as if decrypting only one photo at the beginning?

  • 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-06-03T06:28:16+00:00Added an answer on June 3, 2026 at 6:28 am

    From our discussion above, a likely culprit in the performance degradation is the high number of worker threads. One possible method for limiting the number of threads is to use a fixed (or capped) thread pool, using the classes found in java.util.concurrent.

    You could create a fixed thread pool execution service using a suitable Executors static factory method. Then, you can create asychronous tasks for decrypting individual thumbnails and populating the GridView cells using the returned ExecutorService instance’s submit() method.

    Another possibility may be the new Loaders API (developer.android.com), but I am not sure. I am reading about them right now for my own use. So you may want to check the documentation.

    Yet another alternative is in this answer (stackoverflow.com).

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

Sidebar

Related Questions

I writing simple application that need to make some record of the incoming sound.
I'm writing an application that manages something like Drupal's nodes. I'm planning on using
i am writing an application that will need to store less than about 1mb
I am writing an application that I would like to release binaries for on
I am writing an application that heavily uses cryptology. Like most networked applications, mine
I'm writing an application that uses Apple's kiosk mode. I would like to disable
I'm writing an application that is basically just a preferences dialog, much like the
I am writing an application that retrieves coordinates from a webservice, then plots them
Im writing an application that supposed to send coordinates in an SMS, but I've
I'm writing an application that will create difficult passwords for the user. The user

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.