Question

please help me with to explain it by your word logic and algo Encrypt,Decrypt,solve in Fortran.

please help me with to explain it by your word

logic and algo

Encrypt,Decrypt,solve in Fortran.

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

Algorithm for Encrypt in Fortran:
--------------------------------------------------

FORTRAN Format--ENCRYPT

CALL <ENCRYPT>(
A status,id,algid,key,keylen,iv,bufcnt,data,d$len,
B outdata,buflen,d$fmt,crpt$m,final,flags)
where <ENCRYPT> is
CI2_ENCRYPT for UCS FORTRAN or
C2FENC for ASCII FORTRAN


Algorithm for Decrypt in Fortran:
--------------------------------------------------

FORTRAN Format--Decrypt
CALL <DECRYPT>(
A status,id,algid,key,keylen,iv,bufcnt,data,d$len,
B outdata,buflen,d$fmt,crpt$m,final,flags)
where <DECRYPT> is
CI2_DECRYPT for UCS FORTRAN or
C2FDEC for ASCII FORTRAN

Here i am providing an example for understanding the logic.


Example :
------------------


implicit none

character(80) :: plaintext = "Beware the Jabberwock, my son! The jaws that bite, the claws that catch!", &
ciphertext = ""
character(14) :: key = "VIGENERECIPHER"


call encrypt(plaintext, ciphertext, key)
write(*,*) plaintext
write(*,*) ciphertext
call decrypt(ciphertext, plaintext, key)
write(*,*) plaintext

contains

subroutine encrypt(intxt, outtxt, k)
character(*), intent(in) :: intxt, k
character(*), intent(out) :: outtxt
integer :: chrn
integer :: cp = 1, kp = 1
integer :: i

outtxt = ""
do i = 1, len(trim(intxt))
select case(intxt(i:i))
case ("A":"Z", "a":"z")
select case(intxt(i:i))
case("a":"z")
chrn = iachar(intxt(i:i)) - 32

case default
chrn = iachar(intxt(i:i))

end select

outtxt(cp:cp) = achar(modulo(chrn + iachar(k(kp:kp)), 26) + 65)
cp = cp + 1
kp = kp + 1
if(kp > len(k)) kp = kp - len(k)

end select
end do
end subroutine

subroutine decrypt(intxt, outtxt, k)
character(*), intent(in) :: intxt, k
character(*), intent(out) :: outtxt
integer :: chrn
integer :: cp = 1, kp = 1
integer :: i

outtxt = ""
do i = 1, len(trim(intxt))
chrn = iachar(intxt(i:i))
outtxt(cp:cp) = achar(modulo(chrn - iachar(k(kp:kp)), 26) + 65)
cp = cp + 1
kp = kp + 1
if(kp > len(k)) kp = kp - len(k)
end do
end subroutine
end program

OUTPUT For the program:

---------------------------------------------

 Beware the Jabberwock, my son! The jaws that bite, the claws that catch!
 WMCEEIKLGRPIFVMEUGXQPWQVIOIAVEYXUEKFKBTALVXTGAFXYEVKPAGY
 BEWARETHEJABBERWOCKMYSONTHEJAWSTHATBITETHECLAWSTHATCATCH
Add a comment
Know the answer?
Add Answer to:
please help me with to explain it by your word logic and algo Encrypt,Decrypt,solve in Fortran.
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
  • give me a example Develop a set of functions that will allow you to encrypt a...

    give me a example Develop a set of functions that will allow you to encrypt a string using a Caesar cipher. Develop a set of functions that will allow you to decrypt a string using a Caesar cipher. Develop a set of functions that will help you to solve (break) a Caesar cipher. Encrypt, Decrypt, Solve in COBOL Encrypt, Decrypt, Solve in Fortran

  • give me a example Develop a set of functions that will allow you to encrypt a...

    give me a example Develop a set of functions that will allow you to encrypt a string using a Caesar cipher. Develop a set of functions that will allow you to decrypt a string using a Caesar cipher. Develop a set of functions that will help you to solve (break) a Caesar cipher. Encrypt, Decrypt, Solve in BASIC 1 Encrypt, Decrypt, Solve in Scala (in a procedural manner)

  • please help me to solve (c and d) knowing that d=209 Let the two primes p...

    please help me to solve (c and d) knowing that d=209 Let the two primes p = 41 and q = 17 be given as set-up parameters for RSA. a. Which of the parameters e_1 = 32, e_2 = 49 is a valid RSA exponent? Justify your choice b. Compute the corresponding private key Kpr = (p, q, d). Use the extended Euclidean algorithm for the inversion and point out every calculation step. c. Using the encryption key, encrypt the...

  • Please help me to solve this problem. Design and draw the logic diagram for the following...

    Please help me to solve this problem. Design and draw the logic diagram for the following circuit that takes four inputs A, B, C, D and have two outputs E, F defined as follows. Please use AOI technology to construct your circuit. 1. If A = B = C = D = 1, E = 1. If B = C = 0, E = 0. Otherwise, E = A ⊕ B ⊕ D. 2. If A = 0, then F...

  • C Programming - RSA Encryption I've tried to write a program that can encrypt and decrypt...

    C Programming - RSA Encryption I've tried to write a program that can encrypt and decrypt strings using RSA and want to be able to integrate it into a header file which contains codes for compression, linked list etc.. However, the use of global variables and fixed size of encryption is making it hard to do so Can someone please help me modify the following the code? I want to be able to just pass it in a string to...

  • I need Help to Write a function in C that will Decrypt at least one word with a substitution cipher given cipher text an...

    I need Help to Write a function in C that will Decrypt at least one word with a substitution cipher given cipher text and key My Current Code is: void SubDecrypt(char *message, char *encryptKey) { int iteration; int iteration_Num_Two = 0; int letter; printf("Enter Encryption Key: \n");                                                           //Display the message to enter encryption key scanf("%s", encryptKey);                                                                   //Input the Encryption key for (iteration = 0; message[iteration] != '0'; iteration++)                               //loop will continue till message reaches to end { letter = message[iteration];                                                      ...

  • I need anyone help me solve these questions !! The answers should be your own word,...

    I need anyone help me solve these questions !! The answers should be your own word, NO Plagiarism !! Please do not copy from a book or from the same site or from other students' answers. The work should be your own answers. Please do not answer the handwriting and be a computer writing NO NO handwriting answers. TO NO considered AS Plagiarism 3-Emaiis themost preferred-way of communication in many sectors-currently various threats to the information technologyframework.Explainin thevarious techniques (at...

  • C Programming - RSA encryption Hi there, I'm struggling with writing a C program to encrypt and decrypt a string usi...

    C Programming - RSA encryption Hi there, I'm struggling with writing a C program to encrypt and decrypt a string using the RSA algorithm (C90 language only). It can contain ONLY the following libraries: stdio, stdlib, math and string. I want to use the following function prototypes to try and implement things: /*Check whether a given number is prime or not*/ int checkPrime(int n) /*to find gcd*/ int gcd(int a, int h) void Encrypt(); void Decrypt(); int getPublicKeys(); int getPrivateKeys();...

  • please help solve Computer Eixercise Encrypt the following quote in four-letter blocks, using a. multiplication by 37 modulo 27989898. COMPUTERS ARE USELESS -THEY CAN ONLY GIVE YOU ANSWERS b. Fi...

    please help solve Computer Eixercise Encrypt the following quote in four-letter blocks, using a. multiplication by 37 modulo 27989898. COMPUTERS ARE USELESS -THEY CAN ONLY GIVE YOU ANSWERS b. Find the inverse of 37 in Z27989898 c. The following ciphertext message was encrypted using the method you used in part a (four-letter blocks, multiplication by 37 modulo 27989898). Decrypt the following message to reveal the name of the famous person to whom the quote in part a is attributed. 4589986...

  • Please help me solve this correctly 4. (6 pts) Circle the correct word; a. The stronger...

    Please help me solve this correctly 4. (6 pts) Circle the correct word; a. The stronger a weak acid the (stronger /weaker) it's conjugate base. b. The larger the Kb of a weak base, the (higher / lower) the pH of a 1M solution. c. The larger the weak acid and conjugate base concentration the (higher / lower) the buffe capacity

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