slow but works
This commit is contained in:
commit
36c47811bd
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
1238
Cargo.lock
generated
Normal file
1238
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "vanity-rage"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
"rayon" = "1.8.0"
|
||||||
|
"age" = "0.9.2"
|
||||||
|
"glob-match" = "0.2.1"
|
44
src/main.rs
Normal file
44
src/main.rs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
use age::{self, secrecy::ExposeSecret, Identity, Recipient};
|
||||||
|
use glob_match::glob_match;
|
||||||
|
use rayon::prelude::*;
|
||||||
|
use std::{env, process};
|
||||||
|
|
||||||
|
fn try_generate(pattern: String) -> Option<(String, String)> {
|
||||||
|
let key_priv = age::x25519::Identity::generate();
|
||||||
|
let key_pub = key_priv.to_public();
|
||||||
|
|
||||||
|
// TODO: ignore case
|
||||||
|
glob_match(&pattern, &key_pub.to_string()).then_some((
|
||||||
|
key_priv.to_string().expose_secret().to_string(),
|
||||||
|
key_pub.to_string(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let args = env::args();
|
||||||
|
let pattern = if args.len() < 2 {
|
||||||
|
println!(std::concat!(
|
||||||
|
"Usage: \n",
|
||||||
|
" vanity-rage [QUERY]\n",
|
||||||
|
"\n",
|
||||||
|
"Queries follow standard glob syntax:\n",
|
||||||
|
" ? - match any single character\n",
|
||||||
|
" * - match zero or more characters\n",
|
||||||
|
" [abc] - match any character within the brackets\n",
|
||||||
|
" [!abc] - match any character not within the brackets\n",
|
||||||
|
"\n",
|
||||||
|
"The provided glob should be able to match the returned key length\n",
|
||||||
|
));
|
||||||
|
process::exit(64);
|
||||||
|
} else {
|
||||||
|
format!("age1{}", args.last().unwrap())
|
||||||
|
};
|
||||||
|
|
||||||
|
let keypair: (String, String) = loop {
|
||||||
|
if let Some(x) = try_generate(pattern.clone()) {
|
||||||
|
break x;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("{:#?}", keypair);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user