Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Using Python, how would I alter the functions for atbash_encrypt() and atbash_decrypt(crypto) so that they'll be able to work with ab.atbash_encrypt('HELLO') and ab.atbash_decrypt('SVOOL')?
Transcribed Image Text:def atbash_encrypt():
alpha
reverse_alpha = 'ZYXWVUTSRQPONMLKJIHGFEDCBA'
input_string
output_string
for character in input_string:
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
= input ('Enter string: ')
output (alpha, reverse_alpha, character)
if reverse == None:
output_string = None
%3D
break
else:
output_string += reverse
print('Reverse string:', output_string)
def atbash_decrypt(crypto):
alpha ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
reverse_alpha ='ZYXWVUTSRQPONMLKJIHGFEDCBA'
crypto = crypto.upper()
%3D
message =
for character in crypto:
if character in reverse_alpha:
= reverse_alpha.find(character)
message = message + alpha[character_index]
else:
message = message + character
return message
Transcribed Image Text:import both of the functions from atbash.py below, such that the code
ab.atbash_encrypt('HELLO') and ab.atbash_decrypt('SVOOL') both execute without
issue.
The assert cells below this question only test the import.
N # YOUR CODE HERE
from atbash import atbash_encrypt
from atbash import atbash_decrypt
I assert callable(ab.atbash_encrypt)
# hidden test to ensure atbash_encrypt works on import
NameError
Traceback (most recent call last)
<ipython-input-16-8858e219fd8d> in <module>
----> 1 assert callable(ab.atbash_encrypt)
2
3 # hidden test to ensure atbash_encrypt works on import
NameError: name
ab
is not defined
N assert callable(ab.atbash_decrypt)
# hidden test to ensure atbash_decrypt works on import
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please help me solve this with python. Add your code. In order to have have the decimals correct, make sure you are running the following command in numpy:np.set_printoptions(precision=7, suppress=True, linewidth=100) The expected output is: 1.5549999999999995arrow_forwardAnswer these questions with Python expressions. 'Supercalifragilisticexpialidocious' has how many letters? Is 'ice' a substring of 'Supercalifragilisticexpialidocious'? Supercalifragilisticexpialidocious, Honorificabilitudinitatibus, or Bababadalgharaghtakamminarronnkonn—which is longest? Which composer is first in the dictionary: Berlioz, Borodin, Brian, Bartok, Bellini, Buxtehude, or Bernstein. Last one?arrow_forwardPlease visit https://en.wikipedia.org/wiki/Caesar_cipher. You will be writing code that encrpyts and decrypts using this method. Specifically, you'll be writing functions: E,(1) (z+ n) mod 27 D„(1) (1- n) mod 27 On the Wiki page, the modulus (%) is 26, but we're using 27-why? We are adding an extra symbol { for space. Please visit https://en.wikipedia.org/wiki/ASCII. If you look at the printable ASCII characters, you'll notice that { (hex value 7A) follows z. Thus we can easily extend our cypher to include this symbol for space. Let's see how. 1 sentence "this is a secret message about the class" sentence sentence. replace (" ", "{") 3 print (_sentence) 4 es - 5 for i in sentence: es - encrypt (i, 5) 7 print (es) 6 8. 9 ds - 10 for i in es : 11 ds - decrypt(i, 5) 12 13 O_sentence ds. replace ("{", " ") 14 print (o_sentence) has output 1 this {is{a{secret{message{about {the{class 2 ymnxenxefexjhwjyerjxxfljefgtzyeymjchqfxx this is a secret message about the class In this cypher we are...arrow_forward
- A bit shift is a procedure whereby the bits in a bit string are moved to the left or to the right. For example, we can shift the bits in the string 1011 two places to the left to produce the string 1110. Note that the leftmost two bits are wrapped around to the right side of the string in this operation. Define two scripts, shiftLeft.py and shiftRight.py, that expect a bit string as an input. • The script shiftLeft shifts the bits in its input one place to the left, wrapping the leftmost bit to the rightmost position. • The script shiftRight performs the inverse operation. • Each script prints the resulting string. An example of shiftLeft.py input and output is shown below: Enter a string of bits: Hello world! ello world!H An example of shiftRight,py input and output is shown below: Enter a string of bits: Hello world! !Hello worldarrow_forwardWrite a python program to validate whether a JSON is valid or not. Don't take response from server since it is always correct Make 2 JSON's, 1 --> Correct & 2 ---> In Correctarrow_forwardLet's say that an AES-128 key was 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04. (It's a bad key because it's not random, but we'll use it in this problem anyway.) This is used as "round key 0" what are the first four bytes in "round key 1"? Write each using exactly two hex digits (using lower-case hex for a-f).arrow_forward
- Please answer quicklyarrow_forwardThis question does not require you to run any R code. But suppose you did run the command sd(rpois(n, lambda)) where λ=(1+1)/2 and n was set to be an extremely large number. What answer would you expect? Give your answer as a decimal to two decimal places.arrow_forwardUSING KEIL PLEASE.. Ciphers use many bitwise operations for cryptography. Write an ARM assembly program to use ciphers. See the steps below to implement the cipher. In this program, you will implement a "Symmetric Encryption". Create three variables, Plaintext, Key, and Cipher (5 Points) For encryption, design a key value, assign the last nonzero number of your student ID (#900 number) in a variable called "Key" (5 Points) For example: if your 900 number is 90012450. Assign 5 to the variable Key and use it as the Key for encryption. Use this link for the Links to an external site.video to understand Symmetric Key Cryptography and implement that for encryption and decryption. For the variable Plaintext, assign any four-letter word. Encrypt the plaintext using the value in Key and store the encrypted text in the variable Cipher. Test the encryption by decrypting and storing the decrypted text into register R5. Provide comments to each statementarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education