Skip to content

Commit 32d8089

Browse files
committed
Fix deprecation warning from base64
1 parent ef3c6f7 commit 32d8089

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,11 +1510,13 @@ impl HashAlgorithm {
15101510
}
15111511
}
15121512
pub fn apply(self, value: &str) -> String {
1513+
use base64::Engine as _;
15131514
let bytes = value.as_bytes();
1515+
let standard = base64::engine::general_purpose::STANDARD;
15141516
match self {
1515-
HashAlgorithm::Sha256 => base64::encode(sha2::Sha256::digest(bytes)),
1516-
HashAlgorithm::Sha384 => base64::encode(sha2::Sha384::digest(bytes)),
1517-
HashAlgorithm::Sha512 => base64::encode(sha2::Sha512::digest(bytes)),
1517+
HashAlgorithm::Sha256 => standard.encode(sha2::Sha256::digest(bytes)),
1518+
HashAlgorithm::Sha384 => standard.encode(sha2::Sha384::digest(bytes)),
1519+
HashAlgorithm::Sha512 => standard.encode(sha2::Sha512::digest(bytes)),
15181520
}
15191521
}
15201522
}

0 commit comments

Comments
 (0)