UnpackInplace decrypts pkt using stream cipher s. Returns a slice of pkt containing decrypted plaintext. Note: The data in the input dst will be changed
(pkt []byte, s Cipher)
| 33 | // Returns a slice of pkt containing decrypted plaintext. |
| 34 | // Note: The data in the input dst will be changed |
| 35 | func UnpackInplace(pkt []byte, s Cipher) ([]byte, error) { |
| 36 | if len(pkt) < s.IVSize() { |
| 37 | return nil, ErrShortPacket |
| 38 | } |
| 39 | iv, dst := pkt[:s.IVSize()], pkt[s.IVSize():] |
| 40 | s.Decrypter(iv).XORKeyStream(dst, dst) |
| 41 | return dst, nil |
| 42 | } |
| 43 | |
| 44 | // Unpack decrypts pkt using stream cipher s. |
| 45 | // Returns a slice of dst containing decrypted plaintext. |
no test coverage detected