from web3 import Web3 from flask import Flask, request, jsonify import pbkdf2 import pyaes import json w3 = Web3() def walletCreation(): try: acc = w3.eth.account.create() # print(f'private key={acc._private_key.hex()}, account={acc.address}') encryptPrivateKey = encryptionOfPrivate(acc._private_key.hex(),"MyNextFilm") return acc.address, encryptPrivateKey except Exception as e : print(e) def encryptionOfPrivate(privateKey,key): try: url_string = privateKey iv = 77423458040705335549997212640120530171624814583885731800099110782272387303263 passwordSalt = b"\xd3\x06b\xdf\xdc\xd1u\xd0V\xb2\xd8\xbci\xe9\xc8\r" password = str(key) keyutf = pbkdf2.PBKDF2(password, passwordSalt).read(32) # ciphertext = encrypted url string aes = pyaes.AESModeOfOperationCTR(keyutf, pyaes.Counter(iv)) ciphertext = aes.encrypt(str(url_string)) return ciphertext except: print("Somthing went worng")