Different Results in Go and Pycrypto when using AES-CFB

前端 未结 5 1148
遇见更好的自我
遇见更好的自我 2021-01-02 05:33

I am adding a go application to an already existing python codebase. I\'ve been having trouble dealing with encryption between the languages. This is using go 1.2.1 and Pyth

5条回答
  •  猫巷女王i
    2021-01-02 05:56

    i solve by adapt python code like this (golang encode and python decode):

    # golang encode
    padNum := len(data) % 16
    if padNum != 0 {
        for i := 0; i < 16-padNum; i++ {
            data = append(data, ',')
        }
    }
    
    # python decode
    cipher = AES.new(key=self.key, mode=AES.MODE_CFB, IV=iv,segment_size=128)
    

提交回复
热议问题