algorithm_pseudo_codes
algorithm_pseudo_codes
Constants:
● alphabet = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ' (including space)
● Output: gcd, x, and y such that gcd is the greatest common divisor of a and b, and
a*x + b*y = gcd
1. Initialize x = 0, y = 1, u = 1, v = 0
2. While a is not 0:
● Compute q = b // a and r = b % a
● Update m = x - u * q and n = y - v * q
● Set b = a, a = r, x = u, y = v, u = m, v = n
3. Return gcd = b, x, and y
Function: modinv(a, m)
● Input: Integer a and modulus m
Vigenere Cipher :
IF key_index == LENGTH(vigenere_key)
key_index = 0
END IF
END FOR
RETURN cipher_text
END FUNCTION
IF key_index == LENGTH(vigenere_key)
key_index = 0
END IF
END FOR
RETURN plain_text
END FUNCTION
FUNCTION MAIN
text = 'cryptography is quite important in the cryptocurrency'
encrypted = vigenere_encrypt(text, 'ANIMAL')
PRINT("The encrypted message is: " + encrypted)
PRINT("And the decrypted message is: " + vigenere_decrypt(encrypted, 'ANIMAL'))
END FUNCTION
OTP Algorithm :
# Define the alphabet including space
ALPHABET = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
RETURN cipher_text
RETURN plain
RETURN random
RETURN letter_frequencies
CALL main()