Git Product home page Git Product logo

yyets-restorer's People

Contributors

bennythink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yyets-restorer's Issues

请教一个关于AES的ECB解密的问题

我有一个bat批处理,它的功能是下载某网站的视频,视频有加密,该脚本是调用OpenSSL命令进行解密。解密命令如下:

openssl aes-128-ecb -d -in "被加密的视频文件路径" -out "解密后的视频文件输出路径" -K key字符串
上面这行命令的意思是:调用OpenSSL,-d 解密;-in 输入文件的路径;-out 输出文件的路径; -K 密钥  

通过BAT批处理调用这行命令能解密成功顺利播放,但是当我使用python代码尝试实现这个效果的时候,发现视频解密后无法播放,也就是没有解密成功,python实现这个功能的代码如下:

        crypt = AES.new(key.encode("utf-8"), AES.MODE_ECB)
        plain_text = crypt.decrypt(data) #data是视频的二进制流
        return plain_text.rstrip(b'\0')

但是我发现您的代码是这样写的:

  def decrypt(data, key):
      cipher = Cipher(algorithms.AES(key), modes.ECB(), backend=default_backend())
      decryptor = cipher.decryptor()
      return decryptor.update(data) + decryptor.finalize()

其实我不太理解您的这个Cipher(algorithms.AES(key), modes.ECB(), backend=default_backend())写法,您看看我需要如何改进代码?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.