forked from RustPython/RustPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsha512.rs
More file actions
20 lines (16 loc) · 717 Bytes
/
sha512.rs
File metadata and controls
20 lines (16 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// spell-checker:ignore usedforsecurity HASHXOF
pub(crate) use _sha512::make_module;
#[pymodule]
mod _sha512 {
use crate::hashlib::_hashlib::{HashArgs, HashWrapper, PyHasher};
use crate::vm::{PyObjectRef, PyPayload, PyResult, VirtualMachine};
use sha2::{Sha384, Sha512};
#[pyfunction(name = "sha384")]
fn sha384(args: HashArgs, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
Ok(PyHasher::new("sha384", HashWrapper::new::<Sha384>(args.string)).into_pyobject(vm))
}
#[pyfunction(name = "sha512")]
fn sha512(args: HashArgs, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
Ok(PyHasher::new("sha512", HashWrapper::new::<Sha512>(args.string)).into_pyobject(vm))
}
}