diff --git a/password-hash/src/output.rs b/password-hash/src/output.rs index 7f1998fc7..65ee3484c 100644 --- a/password-hash/src/output.rs +++ b/password-hash/src/output.rs @@ -182,6 +182,11 @@ impl Output { self.encoding } + /// Creates a copy of this [`Output`] with the specified [`Encoding`]. + pub fn with_encoding(&self, encoding: Encoding) -> Self { + Self { encoding, ..*self } + } + /// Get the length of the output value as a byte slice. pub fn len(&self) -> usize { usize::from(self.length)