def ofb(string):

xs = list()
ys = list()
ss = list()

for character in string:
ascii_val = int(ord(character))

xs.append(ascii_val)

key = int("0X08", 16)

iv = int("0XAA", 16)

ss.append((key+11*iv)%256)

ys.append(hex(xs[0]^ss[0]))

for i in range(1, len(xs)):

ss.append((key+11*ss[i-1])%256)

ys.append(hex(xs[i]^ss[i]))

return xs, ys

def cfb(string):

xs = list()

ys = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

key = int("0X08", 16)

iv = int("0XAA", 16)

ys.append(hex(xs[0]^((key+11*iv)%256)))

for i in range(1, len(xs)):

ys.append(hex(xs[i]^(key+11*int(ys[i-1], 16))%256))

return xs, ys

def cbc(string):

xs = list()

ys = list()

ss = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

key = int("0X08", 16)

iv = int("0XAA", 16)

ss.append((key+11*(xs[0]^iv))%256)

ys.append(hex(ss[0]))

for i in range(1, len(xs)):

ss.append((key+11*(xs[i]^ss[i-1]))%256)

ys.append(hex(ss[i]))

return xs, ys

def ecb(string):

xs = list()

ys = list()

key = int("0X08", 16)

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

ys.append(hex((key + 11 * ascii_val) % 256))

return xs, ys

def ctr(string):

xs = list()

ys = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

ss = ["10101000", "10101001", "10101010", "10101011", "10101100", "10101101"]

key = int("0X08", 16)

for i in range(len(xs)):

ei = (key+11*int(ss[i], 2))%256

ys.append(hex(xs[i] ^ ei))

return xs, ys

if __name__ == "__main__":

print("CTR")

word = "beery"

print("\nCTR : ", word)

xs_ctr, ys_ctr = ctr(word)

print("Plain Text", xs_ctr)

print("Cipher Text", ys_ctr)

word = "neary"

print("\nECB : ", word)

xs_ecb, ys_ecb = ecb(word)

print("Plain Text", xs_ecb)

print("Cipher Text", ys_ecb)

word = "leary"

print("\nCFB : ", word)

xs_cfb, ys_cfb = cfb(word)

print("Plain Text", xs_cfb)

print("Cipher Text", ys_cfb)

word = "weary"

print("\nCBC : ", word)

xs_cbc, ys_cbc = cbc(word)

print("Plain Text", xs_cbc)

print("Cipher Text", ys_cbc)

word = "bleary"

print("\nOFB : ", word)

xs_ofb, ys_ofb = ofb(word)

print("Plain Text", xs_ofb)

print("Cipher Text", ys_ofb)

def ofb(string):

xs = list()

ys = list()

ss = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

key = int("0X08", 16)

iv = int("0XAA", 16)

ss.append((key+11*iv)%256)

ys.append(hex(xs[0]^ss[0]))

for i in range(1, len(xs)):

ss.append((key+11*ss[i-1])%256)

ys.append(hex(xs[i]^ss[i]))

return xs, ys

def cfb(string):

xs = list()

ys = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

key = int("0X08", 16)

iv = int("0XAA", 16)

ys.append(hex(xs[0]^((key+11*iv)%256)))

for i in range(1, len(xs)):

ys.append(hex(xs[i]^(key+11*int(ys[i-1], 16))%256))

return xs, ys

def cbc(string):

xs = list()

ys = list()

ss = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

key = int("0X08", 16)

iv = int("0XAA", 16)

ss.append((key+11*(xs[0]^iv))%256)

ys.append(hex(ss[0]))

for i in range(1, len(xs)):

ss.append((key+11*(xs[i]^ss[i-1]))%256)

ys.append(hex(ss[i]))

return xs, ys

def ecb(string):

xs = list()

ys = list()

key = int("0X08", 16)

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

ys.append(hex((key + 11 * ascii_val) % 256))

return xs, ys

def ctr(string):

xs = list()

ys = list()

for character in string:

ascii_val = int(ord(character))

xs.append(ascii_val)

ss = ["10101000", "10101001", "10101010", "10101011", "10101100", "10101101"]

key = int("0X08", 16)

for i in range(len(xs)):

ei = (key+11*int(ss[i], 2))%256

ys.append(hex(xs[i] ^ ei))

return xs, ys

if __name__ == "__main__":

word = "beery"

print("\nCTR : ", word)

xs_ctr, ys_ctr = ctr(word)

print("Plain Text", xs_ctr)

print("Cipher Text", ys_ctr)

word = "neary"

print("\nECB : ", word)

xs_ecb, ys_ecb = ecb(word)

print("Plain Text", xs_ecb)

print("Cipher Text", ys_ecb)

word = "leary"

print("\nCFB : ", word)

xs_cfb, ys_cfb = cfb(word)

print("Plain Text", xs_cfb)

print("Cipher Text", ys_cfb)

word = "weary"
print("\nCBC : ", word)
xs_cbc, ys_cbc = cbc(word)
print("Plain Text", xs_cbc)
print("Cipher Text", ys_cbc)

word = "bleary"
print("\nOFB : ", word)
xs_ofb, ys_ofb = ofb(word)
print("Plain Text", xs_ofb)
print("Cipher Text", ys_ofb)

need this code in decription?

It appears that you have provided a code snippet that includes several encryption algorithms such as OFB, CFB, CBC, ECB, and CTR. Each function takes a string as input and returns the plain text and cipher text for that string.

If you want to understand how each algorithm works and how to use them, you can follow these steps:

1. OFB (Output Feedback):
- The OFB algorithm uses XOR operations between the input string characters and a sequence of pseudo-random numbers generated from a key and an initialization vector (IV).
- The XOR operation is represented by the caret (^) symbol.
- To use the OFB algorithm, call the function "ofb(string)" with your desired string as an argument. This will return lists "xs" and "ys" containing the plain text and cipher text respectively.

2. CFB (Cipher Feedback):
- The CFB algorithm is similar to OFB, but each character is encrypted using the previous cipher text as the feedback to generate the XOR value.
- To use the CFB algorithm, call the function "cfb(string)" with your desired string as an argument. This will return lists "xs" and "ys" containing the plain text and cipher text respectively.

3. CBC (Cipher Block Chaining):
- The CBC algorithm XORs the input string with the previous cipher text and then encrypts it using the given key.
- To use the CBC algorithm, call the function "cbc(string)" with your desired string as an argument. This will return lists "xs" and "ys" containing the plain text and cipher text respectively.

4. ECB (Electronic Codebook):
- The ECB algorithm encrypts each character of the input string independently using the same key for all characters.
- To use the ECB algorithm, call the function "ecb(string)" with your desired string as an argument. This will return lists "xs" and "ys" containing the plain text and cipher text respectively.

5. CTR (Counter):
- The CTR algorithm uses a counter value to generate a sequence of pseudo-random numbers which are then XORed with the input string characters to produce the cipher text.
- To use the CTR algorithm, call the function "ctr(string)" with your desired string as an argument. This will return lists "xs" and "ys" containing the plain text and cipher text respectively.

Please note that the provided code is only for demonstration purposes and should not be used for secure encryption. It is essential to use well-vetted cryptographic libraries for proper encryption and security.