Parse an IV value. - The default IV is returned if *iv* is None. - A random IV is returned if *iv* is -1. - Otherwise, *iv* is returned as is.
(self, iv)
| 126 | default_iv: int |
| 127 | |
| 128 | def parse_iv(self, iv): |
| 129 | """Parse an IV value. |
| 130 | |
| 131 | - The default IV is returned if *iv* is None. |
| 132 | - A random IV is returned if *iv* is -1. |
| 133 | - Otherwise, *iv* is returned as is. |
| 134 | """ |
| 135 | if iv is None: |
| 136 | return self.default_iv |
| 137 | if iv == -1: |
| 138 | return random.randint(1, 0x80000000) |
| 139 | return iv |
| 140 | |
| 141 | def checksum(self, data, init=None): |
| 142 | """Compute the checksum of data with a given initial value. |
no test coverage detected