(crypted, key []byte)
| 44 | } |
| 45 | |
| 46 | func DesDecrypt(crypted, key []byte) ([]byte, error) { |
| 47 | block, err := des.NewCipher(key) |
| 48 | if err != nil { |
| 49 | return nil, err |
| 50 | } |
| 51 | blockMode := cipher.NewCBCDecrypter(block, key) |
| 52 | origData := make([]byte, len(crypted)) |
| 53 | // origData := crypted |
| 54 | blockMode.CryptBlocks(origData, crypted) |
| 55 | origData = PKCS5UnPadding(origData) |
| 56 | // origData = ZeroUnPadding(origData) |
| 57 | return origData, nil |
| 58 | } |
| 59 | |
| 60 | // 3DES解密 |
| 61 | func TripleDesDecrypt(crypted, key, iv []byte) ([]byte, error) { |
no test coverage detected