- 教程
- 教程
- 双倍强度加密(Double Strength Encryption)
- Python Overview and 安装
- Reverse Cipher
- Caesar Cipher
- ROT13算法(ROT13 Algorithm)
- 换位密码(Transposition Cipher)
- 转置密码的加密(Encryption of Transposition Cipher)
- 换位密码的解密(Decryption of Transposition Cipher)
- 加密文件(Encryption of files)
- 解密文件(Decryption of files)
- Base64编码和解码(Base64 Encoding & Decoding)
- XOR Process
- 乘法密码(Multiplicative Cipher)
- Affine Ciphers
- 黑客单字母密码(Hacking Monoalphabetic Cipher)
- 简单的替代密码(Simple Substitution Cipher)
- 简单替换密码的测试(Testing of Simple Substitution Cipher)
- 简单替换密码的解密(Decryption of Simple Substitution Cipher)
- Python Modules of Cryptography
- 了解Vigenere Cipher(Understanding Vignere Cipher)
- 实现Vigenere Cipher(Implementing Vignere Cipher)
- 一次性密码(One Time Pad Cipher)
- 一次性密码密码的实现(Implementation of One Time Pad Cipher)
- 对称和非对称密码学(Symmetric & Asymmetric Cryptography)
- 理解RSA算法(Understanding RSA Algorithm)
- 创建RSA密钥(Creating RSA Keys)
- RSA密码加密(RSA Cipher Encryption)
- RSA密码解密(RSA Cipher Decryption)
- 黑客攻击RSA密码(Hacking RSA Cipher)
- 资源
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
解密文件(Decryption of files)
在本章中,让我们讨论使用Python解密加密文件。 请注意,对于解密过程,我们将遵循相同的过程,但不是指定输出路径,而是关注输入路径或加密的必要文件。
Code
以下是使用Python解密加密文件的示例代码 -
#!/usr/bin/python
# ---------------- READ ME ---------------------------------------------
# This Script is Created Only For Practise And Educational Purpose Only
# This Script Is Created For http://bitforestinfo.blogspot.in
# This Script is Written By
#
#
##################################################
######## Please Don't Remove Author Name #########
############### Thanks ###########################
##################################################
#
#
# =================Other Configuration================
# Usages :
usage = "usage: %prog [options] "
# Version
Version="%prog 0.0.1"
# ====================================================
# Import Modules
import optparse, sys,os
from toolkit import processor as ps
def main():
parser = optparse.OptionParser(usage = usage,version = Version)
parser.add_option(
'-i','--input',type = 'string',dest = 'inputfile',
help = "File Input Path For Encryption", default = None)
parser.add_option(
'-o','--output',type = "string",dest = 'outputfile',
help = "File Output Path For Saving Encrypter Cipher",default = ".")
parser.add_option(
'-p','--password',type = "string",dest = 'password',
help = "Provide Password For Encrypting File",default = None)
(options, args) = parser.parse_args()
# Input Conditions Checkings
if not options.inputfile or not os.path.isfile(options.inputfile):
print " [Error] Please Specify Input File Path"
exit(0)
if not options.outputfile or not os.path.isdir(options.outputfile):
print " [Error] Please Specify Output Path"
exit(0)
if not options.password:
print " [Error] No
exit(0)
inputfile = options.inputfile
outputfile = options.outputfile
password = options.password
work = "D"
ps.FileCipher(inputfile,outputfile,password,work)
return
if __name__ == '__main__':
main()
您可以使用以下命令执行上述代码 -
python pyfilecipher-decrypt.py -i encrypted_file_path -p password
输出 (Output)
执行上面显示的命令时,您可以观察以下代码 -
Note - 输出指定加密前和解密后的哈希值,这会记录同一文件已加密且进程成功。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论