Home>

asked to write a program on a cipher of a wicker. Tell me how to make it take an encrypted word?
Found a way to fold an array, but it is necessary that the final meaning is also evolved. Those if the word false, and the TRUE key, the addition of arrays goes from 0-3, and the index of the fourth element "E" from the first array is folded from 0.
What to do?

Import String
alphabet= {c: i for i, c in enumerate (string.ascii_letters)}
A= INPUT ('Enter the text:')
B= Input ('Enter the key:')
k= ""
LST_A= []
LST_B= []
For i in a:
    LST_A.APPEND (alphabet.get (i))
Print (LST_A)
For i in b:
    lst_b.append (alphabet.get (i))
Print (LST_B)

What is the problem? If you need to fold, then fold.

Эникейщик2021-09-14 12:42:11

The problem is that if the key: 4 letters and the word 5 itself, then the addition is the elements from the 0th to the 3rd, and 4 symbol as it remains and remains: for example: [17,4,5,6,7] + [3,6,5,4]= [20,10, 10, 10, 7]

Sheva122021-09-14 12:42:11

I do not see any addition in the code at all.

Эникейщик2021-09-14 12:42:11
  • Answer # 1

    The code presents two functions that implement coding and decoding according to the vibrant algorithm:

    from Itertools Import Cycle
    alp= 'abcdefghijklmnopqrstuvwxyz'
    Def Encode_Vijn (Text, Keytext):
        f= lambda arg: alp [(alp.index (arg [0]) + alp.index (arg [1])% 26)% 26]
        Return '' .join (MAP (F, Zip (Text, Cycle (Keytext))))
    Def Decode_vijn (Coded_Text, Keytext):
        f= lambda arg: ALP [ALP.INDEX (arg [0]) -alp.index (arg [1])% 26]
        Return '' .join (MAP (F, Zip (Coded_Text, Cycle (Keytext))))
    

    Please try to leave a little more deployed answers. It is possible to give an example of use. You can add the answer by clicking Edit

    aleksandr barakin2021-09-14 18:42:11
  • Answer # 2

    The code presents two functions that implement coding and decoding according to the vibrant algorithm:

    from Itertools Import Cycle
    alp= 'abcdefghijklmnopqrstuvwxyz'
    Def Encode_Vijn (Text, Keytext):
        f= lambda arg: alp [(alp.index (arg [0]) + alp.index (arg [1])% 26)% 26]
        Return '' .join (MAP (F, Zip (Text, Cycle (Keytext))))
    Def Decode_vijn (Coded_Text, Keytext):
        f= lambda arg: ALP [ALP.INDEX (arg [0]) -alp.index (arg [1])% 26]
        Return '' .join (MAP (F, Zip (Coded_Text, Cycle (Keytext))))
    

    Please try to leave a little more deployed answers. It is possible to give an example of use. You can add the answer by clicking Edit

    aleksandr barakin2021-09-14 18:42:11
  • Answer # 3

    Encipher Wizard in English, Encryption:

    Text= "Hello"
        Key= "No"
        Alpha_ENG= [CHR (ORD ('A') + i) For i in Range (26)]
        key_opti= "". JOIN (LIST (KEY) * ((LEN (Text) //Len (Key)) + Len (Key)))
        vizener= "". join ([Alpha_eng [(alpha_eng.index (i) + alpha_eng.index (j))% 26] IF
                        (alpha_eng.Index (i) + alpha_eng.Index (j)) //26!= 0 ELSE
                         alpha_eng [alpha_eng.Index (i) + alpha_eng.index (j)] for i, j in zip (text, key_opti)]
        Print (Vizener)
    

    Welcome to this Club in Russian! Please try to leave a little more deployed answers. You can add the answer by clicking Edit

    aleksandr barakin2021-09-14 14:13:41
  • Answer # 4

    Encipher Wizard in English, Encryption:

    Text= "Hello"
        Key= "No"
        Alpha_ENG= [CHR (ORD ('A') + i) For i in Range (26)]
        key_opti= "". JOIN (LIST (KEY) * ((LEN (Text) //Len (Key)) + Len (Key)))
        vizener= "". join ([Alpha_eng [(alpha_eng.index (i) + alpha_eng.index (j))% 26] IF
                        (alpha_eng.Index (i) + alpha_eng.Index (j)) //26!= 0 ELSE
                         alpha_eng [alpha_eng.Index (i) + alpha_eng.index (j)] for i, j in zip (text, key_opti)]
        Print (Vizener)
    

    Welcome to this Club in Russian! Please try to leave a little more deployed answers. You can add the answer by clicking Edit

    aleksandr barakin2021-09-14 14:13:41
  • Answer # 5

    You have improper implementation of the cipher.

    What can be done:

    1. Read the theory cipher viruseron wiki.

    2. View software implementations.
      http://inventwithpython.com/hacking/chapter19.html.
      or
      https://gist.github.com/dssstr/aedbb5e9f2185f366c6d6b50fad3e4a4

    3. Write your implementation.
    4. profit

    For the answer, thank you, but this is a complex program for a cipher of a wicker, youtu.be/mc_dosckxdy, here the video has a program less than me, look and make sure. That not all programs must match GitHub

    Sheva122021-09-14 12:42:11

    Of course not. But I believe that you first need to understand the algorithm, how it works and only then only implement it in any programming language.

    iapetus2021-09-14 12:42:11
  • Answer # 6

    You have improper implementation of the cipher.

    What can be done:

    1. Read the theory cipher viruseron wiki.

    2. View software implementations.
      http://inventwithpython.com/hacking/chapter19.html.
      or
      https://gist.github.com/dssstr/aedbb5e9f2185f366c6d6b50fad3e4a4

    3. Write your implementation.
    4. profit

    For the answer, thank you, but this is a complex program for a cipher of a wicker, youtu.be/mc_dosckxdy, here the video has a program less than me, look and make sure. That not all programs must match GitHub

    Sheva122021-09-14 12:42:11

    Of course not. But I believe that you first need to understand the algorithm, how it works and only then only implement it in any programming language.

    iapetus2021-09-14 12:42:11