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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:30:41+00:00 2026-05-14T00:30:41+00:00

I am writing a Java application which can encrypt and consequently decrypt whatever binary

  • 0

I am writing a Java application which can “encrypt” and consequently “decrypt” whatever binary file.

I am just a beginner in the “cryptography” area so I would like to write a very simple application for the beginning.

For reading the original file, I would probably use the java.io.FileInputStream class to get the “array of bytes” byte originalBytes[] of the file.

Then I would probably use some very simple cipher, for example “shift up every byte by 1” and then I would get the “encrypted” bytes byte encryptedBytes[] and let’s say that I would also set a “password” for it, for example “123456789”.

Next, when somebody wants to “decrypt” that file, he has to enter the password (“123456789”) first and after that the file could be decrypted (thus “shift down every byte by 1“) and consequently saved to the output file via java.io.FileOutputStream.

I am just wondering how to “store” the password information to the encrypted file so that the decrypting application knows if the entered password and the “real” password equals?

Probably it would be silly to add the password (for example the ASCII ordinal numbers of the password letters) to the beginning of the file (before the encrypted data).

So my main question is how to store the password information to the encrypted file?

  • 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-14T00:30:41+00:00Added an answer on May 14, 2026 at 12:30 am

    It would probably be easier not to check the password give by the user against a global password, rather ensure that only that one password (known by the user) decrypts the ciphertext into the correct plaintext, any other password would return gibberish. This is usually how cryptography works and means you don’t have to store a centralised password anywhere.

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

Sidebar

Related Questions

I'm wondering about writing an application in Java which can synchronize files across my
I am writing a Java swing application which can store resumes (txt,pdf,docx,doc etc.) in
I am writing a Java application that requires access to a database, which is
I'm writing a java application which has to communicate with has to communicate with
I am writing Java application, which is totally GUI-less. It runs in terminal through
I'm writing application which consists of server side on Google App Engine (Java) and
I'm writing a dummy MyAgenda application in Java which has to allow maintenance of
I am writing a Java Application in which I am connecting to a DB2
I'm writing server-application in java which needs to run on ec2 of amazon. I
I'm writing a depsktop application (in Java) that interacts with a database which stores

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.