Skip to content

Commit c639f1a

Browse files
committed
witch to encode_utf8
1 parent ae9358a commit c639f1a

File tree

1 file changed

+2
-2
lines changed
  • bindings/python/src/digests

1 file changed

+2
-2
lines changed

bindings/python/src/digests/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use pyo3::types::{PyBytes, PyString};
1010
pub fn sha512t24u_digest(readable: &Bound<'_, PyAny>) -> PyResult<String> {
1111
if let Ok(s) = readable.downcast::<PyString>() {
1212
// https://discord.com/channels/1209263839632424990/1229461480873922681/1229465185270370376
13-
Ok(sha512t24u(s.to_cow()?.as_bytes())) // Borrowed, no copying
13+
Ok(sha512t24u(s.encode_utf8()?.as_bytes())) // Borrowed, no copying
1414
} else if let Ok(b) = readable.downcast::<PyBytes>() {
1515
Ok(sha512t24u(b.as_bytes())) // Borrowed, no copying
1616
} else {
@@ -22,7 +22,7 @@ pub fn sha512t24u_digest(readable: &Bound<'_, PyAny>) -> PyResult<String> {
2222
pub fn md5_digest(readable: &Bound<'_, PyAny>) -> PyResult<String> {
2323
if let Ok(s) = readable.downcast::<PyString>() {
2424
// https://discord.com/channels/1209263839632424990/1229461480873922681/1229465185270370376
25-
Ok(md5(s.to_cow()?.as_bytes())) // Borrowed, no copying
25+
Ok(md5(s.encode_utf8()?.as_bytes())) // Borrowed, no copying
2626
} else if let Ok(b) = readable.downcast::<PyBytes>() {
2727
Ok(md5(b.as_bytes())) // Borrowed, no copying
2828
} else {

0 commit comments

Comments
 (0)