Question

AUT COMP500/ ENSE501: Week 11- Exercise: EXERCISE NAME: Encrypted ASCII The file encrypted.bin contains an encrypted ASCII im

please in c language

thank u

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the simple C program to print the fliped binary (1byte ) to a image usinf ASCII value.

Note: I have used the sample binary file and decode each byte by flipping all the bits for byte read from encrypted.bin file.

Program:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>

int main(int argc, char * argv[])
{
   char flip='\0';

   if(argc == 2)
   {
      FILE * ft= fopen(argv[1], "rb") ;

      if (ft)
      {
         fseek (ft,0,SEEK_END); //go to end of file
         long size = ftell(ft); //what byte in file am I at?
         fseek (ft,0,SEEK_SET); //go to beginning of file
         int num = (int)size / (int)sizeof(char);
         //    printf("size of the file: %li ,sizeof(int) = %i\n, the number of numbers = %i\n\n", size, (int) sizeof(int), num);
         int i;
         for(i = 0; i < num; i++){
            char temp = '\0'; // read all the generated numbers
            fread(&temp,sizeof(char),1,ft);

            // flip each byte and print the ascii valure for it
            flip = ~temp;

            //print the ascii valure for each byte
            printf("%c", flip);

         }
         fclose( ft ) ;
      }
   }
   else
   {
      printf("Usage: %s encrypted.bin\n", argv[0]);
      return -1;
   }
   return 0;
}


Output

USER> ./a.out a.out
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒o▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒?▒▒▒▒▒▒▒?▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒o▒▒▒▒▒▒▒o▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒k▒▒▒▒▒▒▒k▒▒▒▒▒▒k▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Г▒▒▒▒Г▒ғ▒▒▒▒҇▒▒▒▒▒ь▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒4▒▒h▒ν▒▒▒▒▒{EC▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ь▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒/▒▒▒▒▒▒▒▒▒?▒▒▒▒▒▒▒▒▒O▒%▒▒▒▒▒▒▒▒_▒-▒▒▒▒▒▒▒▒o▒5▒▒▒▒▒▒▒▒=▒▒▒▒▒▒▒▒▒▒▒v.▒▒v▒|▒▒8▒▒▒8>o▒▒▒88▒▒▒X▒▒|;▒<▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
                                                                                                  oo▒|▒t▒▒▒▒▒▒z?▒▒/▒|;▒<ooooooooooooo▒▒v▒▒|�▒▒▒▒▒▒D▒▒▒▒t▒▒▒▒▒~▒▒▒▒>▒|▒▒▒'▒ۙ▒▒▒▒▒|?▒▒v▒▒▒▒▒▒:▒▒▒▒t▒▒▒▒▒▒▒'▒9▒▒▒▒▒▒▒|;▒6<▒▒▒▒▒▒{▒▒▒▒▒▒|▒▒▒▒▒▒▒▒v▒▒G▒▒▒▒▒z?▒▒@▒▒▒66<oo▒▒v▒|▒v▒#▒v▒/9▒▒|▒#▒▒z:▒▒▒E▒▒▒▒t▒/▒|?▒t▒▒v)▒v8[▒v▒▒|▒▒▒{A▒▒▒▒t▒E▒▒▒▒A▒▒▒▒▒v8▒▒t▒▒v8▒▒v▒▒t▒E▒▒▒▒A▒▒▒▒▒v8▒▒t▒v▒8▒▒▒▒▒▒9▒▒▒t▒▒r▒▒v.E▒▒▒▒A▒▒▒▒▒v8▒▒I/w▒▒A▒v8▒|▒▒t▒ĺ▒@▒t▒▒v8▒ܷt▒/▒t▒G▒▒▒▒v)▒v8G▒▒▒▒aG▒G▒▒▒▒6<
<▒▒▒▒▒▒▒▒{▒▒▒▒▒▒v▒▒'▒v▒▒▒r▒l▒▒▒▒r▒s▒▒▒▒v▒▒▒v▒▒▒v▒▒▒v▒▒/▒|dz▒▒v▒v ▒>▒v(▒▒z▒▒▒$▒▒▒▒v▒v     ▒v▒▒#▒|<▒▒▒▒▒t▒▒▒t▒▒▒t▒▒▒t▒▒߳t▒▒׳t▒▒Ϸ|;▒<ooooooo▒▒v▒▒|▒t▒▒▒▒▒▒|▒▒D▒▒▒▒▒▒▒▒|▒/▒t▒|▒▒|;▒6<oo▒|▒▒▒|;▒<▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ڌߚ▒▒▒▒▒▒▒▒ѝ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒o▒▒▒▒▒▒▒▒▒▒▒c▒▒▒▒▒▒▒▒y▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒w▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒v▒▒▒▒▒s▒y▒▒|▒p▒q▒r▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

Add a comment
Know the answer?
Add Answer to:
please in c language thank u AUT COMP500/ ENSE501: Week 11- Exercise: EXERCISE NAME: Encrypted ASCII...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in c language pls AUT COMP500 ENSE501: Week 7 - Exercise: EXERCISE NAME: Draw ASCII Box...

    in c language pls AUT COMP500 ENSE501: Week 7 - Exercise: EXERCISE NAME: Draw ASCII Box Write a function named draw ascii box that will produce output such as the following: Or: Ooooo0 X X X X Ooooo0 Or: =# H H H H H H # The draw ascii box function must take 5 parameters: the character to use for the horizontal sides; the character to use for the vertical sides; the character to use for the corners; the...

  • IN C LANGUAGE PLEASE Open in A AUT COMP500/ ENSE501: Week 7 - Exercise: EXERCISE NAME:...

    IN C LANGUAGE PLEASE Open in A AUT COMP500/ ENSE501: Week 7 - Exercise: EXERCISE NAME: Is Vowel Write a function named is_vowel that accepts a char as input, and returns an integer value of 1 if the parameter input is a vowel. Otherwise the function must return a value of 0. In the main function prompt the user for input, then call is_vowel, and pass in an argument based upon user's input. The main function must then output the...

  • C language huffman This exercise will familiarize you with linked lists, which you will need for...

    C language huffman This exercise will familiarize you with linked lists, which you will need for a subsequent programming Getting Started assignment Overview Requirements Getting Started Submit Start by getting the files. Type 264get hw13 and then cd hw13 from bash. Pre-tester You will get the following files: Q&A Updates 1. huffman.h: An empty header file, you have to define your own functions in this homework. 2. huffman.c: An empty c file, you have to define your own functions in...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • Write this program in C language Ensure the program output is exactly as described, and that...

    Write this program in C language Ensure the program output is exactly as described, and that the whitespace of your source code is well formatted. Utilise good naming practices when declaring variables. EXERCISE NAME: Recursive Movie In the history of Jurassic Park movies the following movies were released: Movie's Name: Jurassic Park The Lost World: Jurassic Park Jurassic Park III Jurassic World Year of Release: Rotten Tomatoes: 1993 93% 1997 51% 2001 50% 2015 72% Implement a structure type named...

  • please help me with this in C# language. Constructors The goal for this exercise is to...

    please help me with this in C# language. Constructors The goal for this exercise is to understand what constructors are, how to define them, and how to call them, including ‘default’ constructors, and including the use of overloading to provide multiple constructors. One of the advantages of having a clear separation between the public interface of an object and private internal implementation of an object is that once you've got the data in the object you can then ask the...

  • C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require...

    C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....

  • C LANGUAGE. PLEASE INCLUDE COMMENTS :) >>>>TheCafe V2.c<<<< #include ...

    C LANGUAGE. PLEASE INCLUDE COMMENTS :) >>>>TheCafe V2.c<<<< #include <stdio.h> int main() { int fries; // A flag denoting whether they want fries or not. char bacon; // A character for storing their bacon preference. double cost = 0.0; // The total cost of their meal, initialized to start at 0.0 int choice; // A variable new to version 2, choice is an int that will store the // user's menu choice. It will also serve as our loop control...

  • Python Project

    AssignmentBitmap files map three 8-bit (1-byte) color channels per pixel. A pixel is a light-emitting "dot" on your screen. Whenever you buy a new monitor, you will see the pixel configuration by its width and height, such as 1920 x 1080 (1080p) or 3840x2160 (4K). This tells us that we have 1080 rows (height), and each row has 1920 (width) pixels.The bitmap file format is fairly straight forward where we tell the file what our width and height are. When...

  • Code is in C# Your instructor would like to thank to Marty Stepp and Hélène Martin...

    Code is in C# Your instructor would like to thank to Marty Stepp and Hélène Martin at the University of Washington, Seattle, who originally wrote this assignment (for their CSE 142, in Java) This program focuses on classes and objects. Turn in two files named Birthday.cs and Date.cs. You will also need the support file Date.dll; it is contained in the starter project for this assignment. The assignment has two parts: a client program that uses Date objects, and a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT