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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:45:27+00:00 2026-05-31T17:45:27+00:00

I have a problem with AES encryption and the customer showed me their PHP

  • 0

I have a problem with AES encryption and the customer showed me their PHP server code for “decrypting”. Curiously enough the exact code has been taken from S.O. (not surprising). I found this out because the code the customer passed me had the exact same comment! 🙂

Anyway, it’s a piece of PHP code taken from this S.O. question.

I am trying to do the same with Java but I don’t know what this exact line is adding:

$key = 'a16byteslongkey!';

$padded_key = $key . str_repeat(chr(0x00), 16); // Argh!

(note the // Argh! comment was not mine 😉

Is it trying to add chr(0x00) to make a 32 bytes key (because the $key is 16?) if so, how would I do the same in Java?

  • 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-31T17:45:28+00:00Added an answer on May 31, 2026 at 5:45 pm

    As Gareth stated this returns the character with ASCII code 0. Using this we can make a function which repeats a string:

    public static String strRepeat(String toRepeat, int reps){
        //Sanity checks go here!
        StringBuilder sb = new StringBuilder();
        for(int x = 0; x < reps; x++){
            sb.append(toRepeat);
        }
        return sb.toString();
    }
    

    Now the line can be replaced with:

    String paddedKey = key + strRepeat('\0', 16); // Argh!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem converting .NET C# AES 128 Encryption to iOS (iPhone). Everything generated
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have an AES encryption being made on two columns: one of these columns
I have a problem in encrypting/decrypting log file generated by log4j's RollingFileAppender. For the
I need to implement 256 bit AES encryption, but all the examples I have
I have encrypted every item in MS Access file using AES. Encryption works great.
I have a problem with ecrypting data using AES-128/ecb/PKCS5Padding+base64. I am using the following
I have AES encrypted data stored in the database using php mysql. Which I
I have following R code: ggplot(data=curve,aes(x = expected, y=result/games)) + geom_point(aes(x=-expected, colour=games)) + stat_function(fun=funx,
How can I encrypt an entire string with AES. The code that I have

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.