Commit d85754b3 authored by arun.uday's avatar arun.uday

test

parents
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N806" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="scripts.config.application_config" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (base64decode)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/base64decode.iml" filepath="$PROJECT_DIR$/.idea/base64decode.iml" />
</modules>
</component>
</project>
\ No newline at end of file
5 python:S3626="Remove this redundant return.(ÙãÞŸ
5 python:S3626B"Remove this redundant return.(ÙãÞŸ
‡ python:S101‘"jRename class "VoidPointer_cffi" to match the regular expression ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$.(ðÖäÒýÿÿÿÿ
j python:S1542"QRename function "VoidPointer" to match the regular expression ^[a-z_][a-z0-9_]*$.(í•Ú¨
F python:S1172²"-Remove the unused function parameter "cdecl".(§Üì‘
| python:S101Ò"dRename class "_Py_buffer" to match the regular expression ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$.(¯á•û
‰ python:S101ö"lRename class "VoidPointer_ctypes" to match the regular expression ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$.(£Ú»öþÿÿÿÿ
j python:S1542‚"QRename function "VoidPointer" to match the regular expression ^[a-z_][a-z0-9_]*$.(í•Ú¨
\ No newline at end of file
b
2venv/Lib/site-packages/Cryptodome/Util/_raw_api.py,d\9\d91cf4b578ffc44db2bf053a64f5a6c85e0ff4ad
\ No newline at end of file
import base64
import os
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import pad
def encrypt(key, message):
keys = key.encode('utf-8')
# keys = key
iv = os.urandom(AES.block_size)
cipher = AES.new(keys, AES.MODE_CBC, iv)
padded_message = pad(message.encode('utf-8'), AES.block_size, style='pkcs7')
ciphertext = cipher.encrypt(padded_message)
encrypted_message = iv + ciphertext
return base64.b64encode(encrypted_message).decode('utf-8')
print(encrypt("kliLensKLiLensKL", "ajil.k@123"))
def _unpad(s):
return s[:-ord(s[len(s) - 1:])]
def decrypt(key, enc):
keys = key.encode('utf-8')
# keys = key
enc = base64.b64decode(enc)
print("enc", enc)
iv = enc[:AES.block_size]
print("iv", iv)
cipher = AES.new(keys, AES.MODE_CBC, iv)
data = cipher.decrypt(enc[AES.block_size:])
print("data", data)
if len(data) == 0:
raise ValueError("Decrypted data is empty")
data = _unpad(data)
print("final", data)
return data.decode('utf-8')
print(decrypt("iojfhuHurjdiojpu", encrypt("iojfhuHurjdiojpu", "lokesh@123")))
# import base64
# from Cryptodome.Cipher import AES
#
#
# def _unpad(s):
# return s[:-ord(s[len(s) - 1:])]
#
#
# def decrypt(key, enc):
# enc = base64.b64decode(enc)
# iv = enc[:AES.block_size]
# cipher = AES.new(key.encode('utf-8'), AES.MODE_GCM, iv)
# data = _unpad(cipher.decrypt(enc[AES.block_size:]))
# print(data)
# return data.decode('utf-8')
import base64
from base64 import b64decode
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import pad
from Cryptodome.Util.Padding import unpad
try:
sensitive_data = b"test123@m"
key = 'kliLensKLiLensKL'.encode('utf-8')
cipher = AES.new(key, AES.MODE_CBC)
ciphertext = cipher.encrypt(pad(sensitive_data, AES.block_size))
ivs = base64.b64encode(cipher.iv).decode('utf-8')
ciphertexts = base64.b64encode(ciphertext).decode('utf-8')
keys = base64.b64encode(key).decode('utf-8')
# print(f"iv: {base64.b64encode(cipher.iv).decode('utf-8')}")
# print(f"ciphertext:{base64.b64encode(ciphertext).decode('utf-8')}")
# print(f"key: {base64.b64encode(base64.b64decode('kliLensKLiLensKL')).decode('utf-8')}")
iv = b64decode(ivs)
ciphertext = b64decode(ciphertexts)
key = b64decode(keys)
print(iv)
print(ciphertext)
print(key)
cipher = AES.new(key, AES.MODE_CBC, iv)
print(cipher)
plaintext = unpad(cipher.decrypt(ciphertext), AES.block_size)
print("Original Message was: ", plaintext)
except (ValueError, KeyError):
print("ERROR!")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment