Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- print(alphabet[0])
- alphadick={}
- for i, letter in enumerate(alphabet):
- alphadick[letter]=i
- print (alphadick)
- alphadick["H"]
- def affinecode(message,a=1,b=0):
- code=""
- for letter in message:
- letter=letter.upper()
- x = alphadick[letter]
- m= (a*x+b)%26
- u= alphabet [m]
- code =code+u
- return (code)
- print(affinecode("ONEWILLSELDOMGOWRONGIFONEATTRIBUTESEXTREMEACATIONSTOVANITYAVEVERAGEESTOHABITONALPETTYTOONESTFEAR",5,18))
- #KFMYGVVEMVHKAWKYZKFWGRKFMSJJZGXOJMEMDJZMAMSCSJGKFEJKTSFGJISTMTMZSWMMEJKBSXGJKFSVPMJJIJKKFMEJRMSZ
- print(affinecode("KFMYGVVEMVHKAWKYZKFWGRKFMSJJZGXOJMEMDJZMAMSCSJGKFEJKTSFGJISTMTMZSWMMEJKBSXGJKFSVPMJJIJKKFMEJRMSZ",21,18))
- #ONEWILLSELDOMGOWRONGIFONEATTRIBUTESEXTREMEACATIONSTOVANITYAVEVERAGEESTOHABITONALPETTYTOONESTFEAR
- print(affinecode("HOWDIDAFOOLANDHISMONEYGETTOGETHERINTHEFIRSTPLACE",11,18))
- #VYUXOXSJYYTSFXVOWMYFQGCQPPYCQPVQDOFPVQJODWPRTSEQ
- print(affinecode("VYUXOXSJYYTSFXVOWMYFQGCQPPYCQPVQDOFPVQJODWPRTSEQ",19,18))
- #HOWDIDAFOOLANDHISMONEYGETTOGETHERINTHEFIRSTPLACE
- print(affinecode("MOLLYSEEMSTOBEINTERCEPTINGOURMESSAGESBETH",23,12))
- #CWFFSKAACKHWJAOZHANGATHOZUWENCAKKMUAKJAHR
- print(affinecode("CWFFSKAACKHWJAOZHANGATHOZUWENCAKKMUAKJAHR",17,12))
- #MOLLYSEEMSTOBEINTERCEPTINGOURMESSAGESBETH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement