乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      [m3u8]關(guān)于AES

       fgh315 2019-02-14
      >>> from Crypto.Cipher import AES >>> from Crypto import Random >>> >>> key = b'Sixteen byte key' >>> iv = Random.new().read(AES.block_size) >>> cipher = AES.new(key, AES.MODE_CFB, iv) >>> msg = iv + cipher.encrypt(b'Attack at dawn')

      >>> from Crypto.Cipher import AES >>> from Crypto import Random >>> >>> key = b'Sixteen byte key' >>> iv = Random.new().read(AES.block_size) >>> cipher = AES.new(key, AES.MODE_CFB, iv) >>> msg = iv + cipher.encrypt(b'Attack at dawn')

      這里的key是16位的byte,iv也是16位byte,上文中的iv是字符串“0xae98961dd802f860ae9b67dd75136a18”,需要轉(zhuǎn)碼

      from binascii import unhexlifyiv = unhexlify('ae98961dd802f860ae9b67dd75136a18')

      from binascii import unhexlifyiv = unhexlify('ae98961dd802f860ae9b67dd75136a18')

      注意去掉字符串前面的0x前綴。

      解析m3u8文件有開(kāi)源的庫(kù),這里推薦:
      https://github.com/globocom/m3u8.git

      采用cipher.decrypt()得到的ts文件和源文件一樣大,但是不能直接播放。。。so,肯定是哪里出問(wèn)題了。。。。

      突然發(fā)現(xiàn)openssl直接有提供aes-128帶key和iv的解碼cmd工具,用這個(gè)試試:

      openssl enc -d -aes-128-cbc -iv {iv的十六進(jìn)制字符串} -K {key的十六進(jìn)制字符串} -in {輸入ts文件} -out {輸出ts文件}

      openssl enc -d -aes-128-cbc -iv {iv的十六進(jìn)制字符串} -K {key的十六進(jìn)制字符串} -in {輸入ts文件} -out {輸出ts文件}

      通過(guò)OpenSSL這個(gè)直接輸出的ts文件可以播放,淚流滿面。。。。。。

      在網(wǎng)上搜了一下這倆的實(shí)現(xiàn):
      Implement OpenSSL AES Encryption in Python
      文章中提到:
      The only non-standard (and most difficult) part is the derivation of the IV and the key from the password.

      關(guān)于IV和key的不是標(biāo)準(zhǔn)部分…

      OpenSSL puts and expects the salt in the first 8 bytes of the encrypted payload.

      點(diǎn)開(kāi)EVP_BytesToKey函數(shù),有詳細(xì)的說(shuō)明。

      難道說(shuō)openssl需要讀取加密的ts文件頭8字節(jié)作為salt?

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多