summaryrefslogtreecommitdiffstats
path: root/vendor/base64ct/src/alphabet/bcrypt.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:41 +0000
commit10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 (patch)
treebdffd5d80c26cf4a7a518281a204be1ace85b4c1 /vendor/base64ct/src/alphabet/bcrypt.rs
parentReleasing progress-linux version 1.70.0+dfsg1-9~progress7.99u1. (diff)
downloadrustc-10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87.tar.xz
rustc-10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87.zip
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/base64ct/src/alphabet/bcrypt.rs')
-rw-r--r--vendor/base64ct/src/alphabet/bcrypt.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/base64ct/src/alphabet/bcrypt.rs b/vendor/base64ct/src/alphabet/bcrypt.rs
new file mode 100644
index 000000000..4227dbfcf
--- /dev/null
+++ b/vendor/base64ct/src/alphabet/bcrypt.rs
@@ -0,0 +1,33 @@
+//! bcrypt Base64 encoding.
+
+use super::{Alphabet, DecodeStep, EncodeStep};
+
+/// bcrypt Base64 encoding.
+///
+/// ```text
+/// ./ [A-Z] [a-z] [0-9]
+/// 0x2e-0x2f, 0x41-0x5a, 0x61-0x7a, 0x30-0x39
+/// ```
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct Base64Bcrypt;
+
+impl Alphabet for Base64Bcrypt {
+ const BASE: u8 = b'.';
+
+ const DECODER: &'static [DecodeStep] = &[
+ DecodeStep::Range(b'.'..=b'/', -45),
+ DecodeStep::Range(b'A'..=b'Z', -62),
+ DecodeStep::Range(b'a'..=b'z', -68),
+ DecodeStep::Range(b'0'..=b'9', 7),
+ ];
+
+ const ENCODER: &'static [EncodeStep] = &[
+ EncodeStep::Apply(b'/', 17),
+ EncodeStep::Apply(b'Z', 6),
+ EncodeStep::Apply(b'z', -75),
+ ];
+
+ const PADDED: bool = false;
+
+ type Unpadded = Self;
+}