1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gnesinka [82]
3 years ago
10

Encryption Using Rotate Operations Write a procedure that performs simple encryption by rotating each plaintext byte a varying n

umber of positions in different directions. For example, in the following array that represents the encryption key, a negative value indicates a rotation to the left and a positive value indicates a rotation to the right. The integer in each position indicates the magnitude of the rotation: key BYTE -2, 4, 1, 0, -3, 5, 2, -4, -4, 6
Computers and Technology
1 answer:
lesantik [10]3 years ago
8 0

Answer:

Check the explanation

Explanation:

1) Assembly language code for Encryption using rotate operations.

INCLUDE Irvine32.inc

INCLUDE Macros.inc

BufSize = 80

.data

  key BYTE 6, 4, 1, 2, 7, 5, 2, 4, 3, 6

  myText BYTE "This text is going to be encrypted.", 0

  buffer BYTE BufSize DUP(?),0,0

  stdInHandle HANDLE ?

  bytesRead DWORD ?

.code

main PROC

  ;Pass the pointer to the text string in EDX,

  MOV EDX, OFFSET myText

 

  ;the array size to ECX

  MOV ECX, SIZEOF myText

 

  ;pointer to the key array in ESI,  

  MOV ESI, OFFSET key

  ;the direction value (0 or 1) in EBX

  MOV EBX, 0 ; rotate left for encryption

  call WriteString

  call Crlf

  call encDecText

  call WriteString

  call Crlf

  MOV EBX, 1

  call encDecText

  call WriteString

  call Crlf

  ;bonus - get string from console and encrypt

  mWriteln "Write a text to be encrypted."

  ; Get handle to standard input

  INVOKE GetStdHandle, STD_INPUT_HANDLE

  mov stdInHandle,eax

  ; Wait for user input

  INVOKE ReadConsole, stdInHandle, ADDR buffer,

  BufSize, ADDR bytesRead, 0

  ;encrypt and output to console

  MOV EDX, OFFSET buffer

  MOV ECX, BufSize

  MOV EBX, 0

  call encDecText

  call WriteString

  call Crlf

  ;decrypt and output to console

  MOV EBX, 1

  call encDecText

  call WriteString

  INVOKE ExitProcess,0 ; end the program

main ENDP

encDecText PROC

  ;Receives EDX - OFFSET of the text

  ; ECX - SIZE of the text

  ; ESI - OFFSET of the key

  ; EBX - rotation direction 0 for left 1 for right

  PUSHAD

  CMP EBX, 0

  JE equals

      MOV EBX, ESI

      ADD EBX, 9 ;the length of key

      loopNotEquals:

      MOV AL, [EDX] ; value of the text

      PUSH ECX

      MOV CL, [ESI] ; value of the key

      ROR AL, CL ; ror the text by the key

      MOV [EDX], AL

      POP ECX

      CMP ESI, EBX ; if all the keys are used, reset the offset so it uses the beginning

      JE reset1

     

      INC ESI

     

      JMP endReset1

      reset1:

      SUB ESI, 9

      endReset1:

     

      INC EDX

      loop loopNotEquals

      mWriteln "Input decrypted."

  JMP endCMP

  equals:

      MOV EBX, ESI

      ADD EBX, 9 ; the length of key

      loopEquals:

      MOV AL, [EDX] ; value of the text

      PUSH ECX

      MOV CL, [ESI] ; value of the key

      ROL AL, CL ; rol the text by the key

      MOV [EDX], AL

      POP ECX

      CMP ESI, EBX ; if all the keys are used, reset the offset so it uses the beginning

      JE reset2

      INC ESI

     

      JMP endReset2

      reset2:

      SUB ESI, 9

      endReset2:

      INC EDX

      loop loopEquals

      mWriteln "Input encrypted."

  endCMP:

  POPAD

  RET

encDecText ENDP

END main

Save the files with .asm extension.

You might be interested in
im running out of gb on my phone, I have a lot of pics saved there and they're taking a lot of space, is there a way to back up
Varvara68 [4.7K]

Answer:

Google Drive

Explanation:

You should be able to download Google Drive, upload the pictures on there and delete them from your gallery. Then you can view them anytime you want.

3 0
3 years ago
Which one of these is least like the others javascript ruby python mysql.
Cerrena [4.2K]

MySQL is a relational database management system based on the structured query language, JavaScript, Ruby and Python are programming languages ​​used largely in web development.

<h3>What is MySQL?</h3>

It is a system that allows database management, that is, it is a database query language that is used to define relational database structures.

<h3>Characteristics of MySQL</h3>

  • The system works on the client-server principle, where the server represents the actual database management system and is responsible for storing and distributing the data.

  • It can be used on Windows, Linux, Unix and some other operating systems.

Therefore, we can conclude that MySQL is a relational database management system based on the structured query language, JavaScript, Ruby and Python are programming languages ​​used largely in web development.

Learn more about MySQL here: brainly.com/question/4964005

6 0
2 years ago
What is included in a linked list node?
Annette [7]

Explanation:

In its most basic form, each node contains:

data, and a reference (in other words, a

link) to the next node in the sequence. A

linked list whose nodes contain two fields:

an integer value and a link to the next node.

The last node is linked to a terminator used

to signify the end of the list.

8 0
3 years ago
ASAP please
Semenov [28]
I think it’s 4


a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
5 0
3 years ago
The Thing method printMessage prints a string consisting of the name of the object followed by "_is_great". Suppose the name of
Harman [31]

Answer:

Written in C++

The statement that prints the required output is:

<em>printMessage(favFood); </em>

Explanation:

The full program is with comment is:

#include<iostream>

using namespace std;

//The method begins here

void printMessage(string favFood){

//This line prints the required output

cout<<favFood<<"_is_great";

}

//The main method starts here

int main()

{

//This line declares favFood as string

string favFood;

//This line prompts user for input

cout<<"Food: ";

//This line gets the input

cin>>favFood;

//This line calls the printMessage method

printMessage(favFood);

return 0;

}

4 0
3 years ago
Other questions:
  • You can put a small level on your camera to help keep the horizons straight? TRUE OR FALSE
    14·2 answers
  • Columns can be added to a page in the page layout tab in the blank grouping
    10·2 answers
  • the piece of hardware that contains the circuitry that processes the information coming in to the computer
    13·1 answer
  • what are Include the data on usage you gather from your interactions with friends or by listening to people on the radio or on T
    7·1 answer
  • In this problem, we explore some of the properties of the CRC. For the generator G (=1001) given in Section 5.2.3, answer the fo
    6·1 answer
  • What command is used to add a reflection or an outline to text
    7·1 answer
  • You are setting up your Windows computer to connect to the Internet and notice that when you type www.microsoft, the browser doe
    15·1 answer
  • What type of error occurred with the code below??
    11·1 answer
  • Explain approaches of AI​
    12·2 answers
  • Why does binary addition have a rule for 1 + 1 + 1 if only two numbers<br> are being added together?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!