Return a separate copy of this hashing object. An update to this copy won't affect the original object.
(self)
| 164 | inst.update(msg) |
| 165 | |
| 166 | def copy(self): |
| 167 | """Return a separate copy of this hashing object. |
| 168 | |
| 169 | An update to this copy won't affect the original object. |
| 170 | """ |
| 171 | # Call __new__ directly to avoid the expensive __init__. |
| 172 | other = self.__class__.__new__(self.__class__) |
| 173 | other.digest_size = self.digest_size |
| 174 | other.block_size = self.block_size |
| 175 | if self._hmac: |
| 176 | other._hmac = self._hmac.copy() |
| 177 | other._inner = other._outer = None |
| 178 | else: |
| 179 | other._hmac = None |
| 180 | other._inner = self._inner.copy() |
| 181 | other._outer = self._outer.copy() |
| 182 | return other |
| 183 | |
| 184 | def _current(self): |
| 185 | """Return a hash object for the current state. |