(self, encoded)
| 606 | return "%s$%d$%s$%d$%d$%s" % (self.algorithm, n, force_str(salt), r, p, hash_) |
| 607 | |
| 608 | def decode(self, encoded): |
| 609 | algorithm, work_factor, salt, block_size, parallelism, hash_ = encoded.split( |
| 610 | "$", 6 |
| 611 | ) |
| 612 | assert algorithm == self.algorithm |
| 613 | return { |
| 614 | "algorithm": algorithm, |
| 615 | "work_factor": int(work_factor), |
| 616 | "salt": salt, |
| 617 | "block_size": int(block_size), |
| 618 | "parallelism": int(parallelism), |
| 619 | "hash": hash_, |
| 620 | } |
| 621 | |
| 622 | def verify(self, password, encoded): |
| 623 | decoded = self.decode(encoded) |
no test coverage detected