mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Include SHAKE algorithm names in HASHXOF repr (#7132)
This commit is contained in:
1 parent
759a3c44c8
commit
77583c7e7e
2 files changed
+10
-2
No files matched your search
Vendored
-1
@@ -557,7 +557,6 @@ class HashLibTestCase(unittest.TestCase):
|
||||
self.check_blocksize_name('sha384', 128, 48)
|
||||
self.check_blocksize_name('sha512', 128, 64)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 'shake' not found in '<_hashlib.hashxof object at 0xc68a2c800>'
|
||||
@requires_sha3
|
||||
def test_blocksize_name_sha3(self):
|
||||
self.check_blocksize_name('sha3_224', 144, 28)
|
||||
|
||||
@@ -371,7 +371,7 @@ pub mod _hashlib {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyclass(flags(IMMUTABLETYPE))]
|
||||
#[pyclass(with(Representable), flags(IMMUTABLETYPE))]
|
||||
impl PyHasherXof {
|
||||
fn new(name: &str, d: HashXofWrapper) -> Self {
|
||||
Self {
|
||||
@@ -447,6 +447,15 @@ pub mod _hashlib {
|
||||
}
|
||||
}
|
||||
|
||||
impl Representable for PyHasherXof {
|
||||
fn repr_str(zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<String> {
|
||||
Ok(format!(
|
||||
"<{} _hashlib.HASHXOF object @ {:#x}>",
|
||||
zelf.name, zelf as *const _ as usize
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[pyfunction(name = "new")]
|
||||
fn hashlib_new(args: NewHashArgs, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
let data = resolve_data(args.data, args.string, vm)?;
|
||||
|
||||
Reference in new issue
Block a user