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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:54:10+00:00 2026-06-09T05:54:10+00:00

Possible Duplicate: How can I decrypt this encryption routine? I have been on this

  • 0

Possible Duplicate:
How can I decrypt this encryption routine?

I have been on this program for a week now and I am so confused. I tried everything and anything
but I didn’t manage to make it work. I would really appreciate it if you could give me some help with my program.
thank you.

I have the following code and I need to write the Decryption routine for it.

OChars = Original char -> is the word which the user types in.           
EKey = The Encryption Key (one letter)              
Length = The length of characters that the user needs to put             
EChars = Stores the Encrypted characters in so the decryption routine can use it to decrypt it.

    void encrypt_chars (int length, char EKey){
char temp_char;                 // original/encrypted char temporary store

for (int i = 0; i < length; i++){
    temp_char = OChars [i];     // get next char from original string
    __asm {                     // call the encrypt subroutine
        push   eax              // save register values on stack to be safe
        push   ecx
        movsx  ecx,temp_char    // enregister the source character
        movsx  eax,EKey         // and encryption key.
        call   encryptB         // calls the encryption subroutingencrypt the character
        mov    temp_char,al     // only need lower byte of EAX to return encrypted char
        pop    ecx              // restore original register values from stack
        pop    eax
    }
    EChars [i] = temp_char;     // Store encrypted char in the encrypted chars array
   }
     return;

encryption routine ASM          

     __asm {

encryptB: push edx          //saves register value edx on stack
          push ecx          //saves register value ecx on stack
          not  eax          //
          add  eax,0x04     //add 4 to eax register
          mov  edx,eax      //move eax to edx
          pop  eax          //brings eax back to
          xor  eax,edx      //clear values to zero
          pop  edx          //bring edx back 
          rol  al,3         //three times.
          sub  al,0x02      //subtracts 2 from al
          ret 
}               
Here ends the encryption part            
The decryption routine will start as follows             

void decrypt_chars (int length, char EKey){
  char temp_char;                       

for (int i = 0; i < length; i++){
    temp_char = EChars [i];         
    __asm {                         


     }

      DChars [i] = temp_char;           
}
 return;

decryption routine ASM

__asm {


      }
  • 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-09T05:54:11+00:00Added an answer on June 9, 2026 at 5:54 am

    Because it XOR’s with the f(Key) where f is some function, all computations have to be undone except the ones that make up f – they have to be done normally.

    So, something like this: (not tested)

    ; eax = EKey, cl = char
    decryptB:
      add ecx, 2   // undo sub 2
      ror cl, 3    // undo rol
      not eax      // actually do not
      add eax, 4   // actually do add 4
      xor eax, ecx // undo xor
      ret
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Can I run from command line program created by Eclipse? I am
Possible Duplicate: Can I scroll a ScrollView programmatically in Android? I have a chat
Possible Duplicate: Can you animate a height change on a UITableViewCell when selected? This
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: PHP 2-way encryption: I need to store passwords that can be retrieved
Possible Duplicate: Can you have multiple $(document).ready(function() sections? Is it OK to have multiple
Possible Duplicate: Can't pass mysqli connection in session in php Many of us have
Possible Duplicate: Can a JavaScript object have a prototype chain, but also be a
Possible Duplicate: Can select * usage ever be justified? Curious to hear this from

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.