AES encryption in python Lec25
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=BWdUwBgzVt4
In this video, I have talked about the fundamentals of programming and Python. If you complete this, you will be well-versed in using tuples for different use cases. • Directly connect with me at:- https://topmate.io/manish_kumar25 • Source Code:- • #Requirements:- pip install pycryptodome • pip install pycryptodomex • import base64 • from Cryptodome.Cipher import AES • from Cryptodome.Protocol.KDF import PBKDF2 • import os, sys • from loguru import logger • try: • key = key1 • iv = my_username_pass • salt = salt • if not (key and iv and salt): • raise Exception(F Error while fetching details for key/iv/salt ) • except Exception as e: • logger.error( Error occurred. Details: %s , e) • sys.exit(0) • BS = 16 • pad = lambda s: bytes(s + (BS - len(s) % BS) * chr(BS - len(s) % BS), 'utf-8') • unpad = lambda s: s[0:-ord(s[-1:])] • def get_private_key(): • Salt = salt.encode('utf-8') • kdf = PBKDF2(key, Salt, 64, 1000) • key32 = kdf[:32] • return key32 • • def encrypt(raw): • raw = pad(raw) • cipher = AES.new(get_private_key(), AES.MODE_CBC, iv.encode('utf-8')) • return base64.b64encode(cipher.encrypt(raw)) • • def decrypt(enc): • cipher = AES.new(get_private_key(), AES.MODE_CBC, iv.encode('utf-8')) • return unpad(cipher.decrypt(base64.b64decode(enc))).decode('utf8') • print(encrypt( manish )) • print(decrypt( U1AMRIQSTYosVJCmmqUHnA== )) • • Discord channel:- / discord • For more queries reach out to me on my below social media handle. • Follow me on LinkedIn:- / manish-kumar-373b86176 • Follow Me On Instagram:- / competitive_gyan1 • Follow me on Facebook:- / manish12340 • My Second Channel -- / @competitivegyan1 • Interview series Playlist:- • Interview Questions and answers • • My Gear:- • Rode Mic:-- https://amzn.to/3RekC7a • Boya M1 Mic-- https://amzn.to/3uW0nnn • Wireless Mic:-- https://amzn.to/3TqLRhE • Tripod1 -- https://amzn.to/4avjyF4 • Tripod2:-- https://amzn.to/46Y3QPu • camera1:-- https://amzn.to/3GIQlsE • camera2:-- https://amzn.to/46X190P • Pentab (Medium size):-- https://amzn.to/3RgMszQ (Recommended) • Pentab (Small size):-- https://amzn.to/3RpmIS0 • Mobile:-- https://amzn.to/47Y8oa4 ( Aapko ye bilkul nahi lena hai) • Laptop -- https://amzn.to/3Ns5Okj • Mouse+keyboard combo -- https://amzn.to/3Ro6GYl • 21-inch Monitor-- https://amzn.to/3TvCE7E • 27-inch Monitor-- https://amzn.to/47QzXlA • iPad Pencil:-- https://amzn.to/4aiJxiG • iPad 9th Generation:-- https://amzn.to/470I11X • Boom Arm/Swing Arm:-- https://amzn.to/48eH2we • My PC Components:- • intel i7 Processor:-- https://amzn.to/47Svdfe • G.Skill RAM:-- https://amzn.to/47VFffI • Samsung SSD:-- https://amzn.to/3uVSE8W • WD Blue HDD:-- https://amzn.to/47Y91QY • RTX 3060Ti Graphic card:- https://amzn.to/3tdLDjn • Gigabyte Motherboard:-- https://amzn.to/3RFUTGl • O11 Dynamic Cabinet:-- https://amzn.to/4avkgSK • Liquid cooler:-- https://amzn.to/472S8mS • Antec Prizm FAN:-- https://amzn.to/48ey4Pj
#############################
