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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:57:44+00:00 2026-05-18T11:57:44+00:00

I am trying to reimplement a non deterministic encryption function from javascript to java.

  • 0

I am trying to reimplement a non deterministic encryption function from javascript to java. I noticed however that the output of the function is different every time. However, whenever I decrypt the output, it always returns the original text.

For example:

word: hello

encrypted: ?HX?631ffe50353ddda632a7e8fa11136d6ffaa584eb43b34c96005b6256f9dc 4121c7a8545d79887b900672e5870d702441?H

decrypted: hello

word: hello

encrypted: ?HX?dfea4d1d30ebd5fc871c7c92d0230baf9e5298b19c3cfa0770fe2d2035f8 dad0116f2963b115c85c9d4725be505fca54?H

decrypted: hello

and so on….

To unit test this, one way I can think of is to also implement the decrypt function in java and then decrypt the output of the encryption function. If the decryption yields the original text then the encryption is correct.

For example:

encrypted = Encrypt_text(word);
assertEquals(word,Decrypt_text(encrypted);

Any other suggestions…?

  • 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-18T11:57:45+00:00Added an answer on May 18, 2026 at 11:57 am

    Better to use the original decrypt function to validate your encrypt function, rather than a new decrypt routine. If you write both and use them to test each other you will have validated that the data round-trips correctly but you will not have validated the intermediate result.

    You could use Mozilla Rhino to run the Javascript decrypt routine: http://www.mozilla.org/rhino/

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

Sidebar

Related Questions

Trying to create an app that does some socket communication (Writing only). I can
Trying to assign a key to each field in android to reference in Java.
Trying to get this to function, randomly chooses 1 of the 3 color choices.
Trying to change input type attribute from password to text . $('.form').find('input:password').attr({type:text}); Why this
trying to figure out how to add zeroes in front of a random generated
Trying to find some information on the GC. In my log i see these
Trying to track down a bug in an application, but need to confirm whether
Trying to figure out out how to overload parenthesis on a class. I have
Trying to build a legacy code in VS2005 and get errors in VC header
I'm writing some simple queries which return a single value and I'd like to

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.