Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions base64ct/src/alphabet/crypt.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
//! `crypt(3)` Base64 encoding.

#![allow(deprecated)]

use super::{Alphabet, DecodeStep, EncodeStep};

/// `crypt(3)` Base64 encoding.
/// DEPRECATED: non-standard big endian variant of the `crypt(3)` Base64 encoding.
///
/// ```text
/// [.-9] [A-Z] [a-z]
/// 0x2e-0x39, 0x41-0x5a, 0x61-0x7a
/// ```
///
/// Note this encodes using a big endian variant of Base64. Most modern algorithms which can be
/// used via `crypt(3)` use the little endian [`Base64ShaCrypt`][`crate::Base64ShaCrypt`] variant.
/// <div class="warning">
/// This encodes using a big endian variant of Base64. Most modern algorithms which can be
/// used via `crypt(3)` use the [`Base64ShaCrypt`][`crate::Base64ShaCrypt`] encoding.
/// </div>
#[deprecated(
since = "1.8.2",
note = "non-standard encoding. Use Base64ShaCrypt for all crypt(3) algorithms"
)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Base64Crypt;

Expand Down
7 changes: 2 additions & 5 deletions base64ct/src/alphabet/shacrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use super::{Alphabet, DecodeStep, EncodeStep};

/// Little endian variant of the `crypt(3)` Base64 encoding.
/// `crypt(3)` Base64 encoding.
///
/// Used by the following schemes:
/// This is the standard Base64 encoding used by password hashes for the following schemes:
/// - MD5-Crypt
/// - scrypt
/// - SHA1-Crypt
Expand All @@ -16,9 +16,6 @@ use super::{Alphabet, DecodeStep, EncodeStep};
/// [.-9] [A-Z] [a-z]
/// 0x2e-0x39, 0x41-0x5a, 0x61-0x7a
/// ```
///
/// This uses the same alphabet as [`Base64Crypt`][`crate::Base64Crypt`], but uses a little endian
/// variant of Base64.
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Base64ShaCrypt;

Expand Down
4 changes: 3 additions & 1 deletion base64ct/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ mod test_vectors;
pub use crate::{
alphabet::{
bcrypt::Base64Bcrypt,
crypt::Base64Crypt,
shacrypt::Base64ShaCrypt,
standard::{Base64, Base64Unpadded},
url::{Base64Url, Base64UrlUnpadded},
Expand All @@ -101,5 +100,8 @@ pub use crate::{
line_ending::LineEnding,
};

#[allow(deprecated)]
pub use crate::alphabet::crypt::Base64Crypt;

/// Minimum supported line width.
const MIN_LINE_WIDTH: usize = 4;
2 changes: 2 additions & 0 deletions base64ct/tests/crypt.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! `crypt(3)` Base64 tests

#![allow(deprecated)]

#[macro_use]
mod common;

Expand Down