Cryptography decryption Chacha20
from flask import Flask, make_response, request from Crypto.Util.number import * from Crypto.Cipher import ChaCha20_Poly1305 import secrets import requests import hashlib CHACHA_KEY = secrets.token_bytes(32) app = Flask(__name__) encrypted_text = [] def sha256(msg): return hashlib.sha256(msg).digest() def encrypt_msg(msg, nonce): nonce = sha256(msg[:32] + nonce[:32])[:12] cipher = ChaCha20_Poly1305.new(key=CHACHA_KEY, nonce=nonce) ct, tag = cipher.encrypt_and_digest(msg) return ct+tag+nonce def decrypt_msg(msg): ct = […]