seven sevens
This commit is contained in:
commit
cb549c5988
3 changed files with 233 additions and 0 deletions
109
Cargo.lock
generated
Normal file
109
Cargo.lock
generated
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer",
|
||||||
|
"crypto-common",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.162"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pearls"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"itertools",
|
||||||
|
"sha2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha2"
|
||||||
|
version = "0.10.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures",
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "pearls"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
itertools = "0.13.0"
|
||||||
|
sha2 = "0.10.8"
|
116
src/main.rs
Normal file
116
src/main.rs
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
use itertools::Itertools;
|
||||||
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
|
// we could be smart with prefixes
|
||||||
|
fn main() {
|
||||||
|
let choices = [
|
||||||
|
vec![
|
||||||
|
"",
|
||||||
|
"they say ",
|
||||||
|
"they say that ",
|
||||||
|
"it's true! ",
|
||||||
|
"it's true: ",
|
||||||
|
"did you know ",
|
||||||
|
"did you know that ",
|
||||||
|
],
|
||||||
|
vec!["the "],
|
||||||
|
vec![
|
||||||
|
"sha",
|
||||||
|
"Sha",
|
||||||
|
"SHA",
|
||||||
|
"sha-",
|
||||||
|
"SHA-",
|
||||||
|
"Sha-",
|
||||||
|
"sha ",
|
||||||
|
"Sha ",
|
||||||
|
"SHA ",
|
||||||
|
"Secure Hash Algorithm ",
|
||||||
|
"secure hash algorithm ",
|
||||||
|
],
|
||||||
|
vec![
|
||||||
|
"256",
|
||||||
|
"2 5 6",
|
||||||
|
"two five six",
|
||||||
|
"two-fifty-six",
|
||||||
|
"two hundred and fifty six",
|
||||||
|
],
|
||||||
|
vec![" "],
|
||||||
|
vec!["hash", "digest"],
|
||||||
|
vec![" of "],
|
||||||
|
vec!["this sentence", "this message", "this piece of digitext"],
|
||||||
|
vec![" has "],
|
||||||
|
vec![
|
||||||
|
"seven",
|
||||||
|
"7",
|
||||||
|
"7 (seven)",
|
||||||
|
"seven (7)",
|
||||||
|
"7!",
|
||||||
|
"7(!)",
|
||||||
|
"seven!",
|
||||||
|
"seven(!)",
|
||||||
|
"7!!",
|
||||||
|
"7(!!)",
|
||||||
|
"seven!!",
|
||||||
|
"seven(!!)",
|
||||||
|
"7!!!",
|
||||||
|
"7(!!!)",
|
||||||
|
"seven!!!",
|
||||||
|
"seven(!!!)",
|
||||||
|
"7!!!!!!!",
|
||||||
|
"7(!!!!!!!)",
|
||||||
|
"seven!!!!!!!",
|
||||||
|
"seven(!!!!!!!)",
|
||||||
|
],
|
||||||
|
vec![" "],
|
||||||
|
vec![
|
||||||
|
"7s",
|
||||||
|
"sevens",
|
||||||
|
"7s!",
|
||||||
|
"7s(!)",
|
||||||
|
"sevens!",
|
||||||
|
"sevens(!)",
|
||||||
|
"7s!!",
|
||||||
|
"7s(!!)",
|
||||||
|
"sevens!!",
|
||||||
|
"sevens(!!)",
|
||||||
|
"7s!!!",
|
||||||
|
"7s(!!!)",
|
||||||
|
"sevens!!!",
|
||||||
|
"sevens(!!!)",
|
||||||
|
"7s!!!!!!!",
|
||||||
|
"7s(!!!!!!!)",
|
||||||
|
"sevens!!!!!!!",
|
||||||
|
"sevens(!!!!!!!)",
|
||||||
|
],
|
||||||
|
vec![" "],
|
||||||
|
vec![
|
||||||
|
"in a row",
|
||||||
|
"in one group",
|
||||||
|
"all together",
|
||||||
|
"all together :)",
|
||||||
|
],
|
||||||
|
vec!["! ", ". ", " "],
|
||||||
|
vec![
|
||||||
|
"isn't that",
|
||||||
|
"i think that's",
|
||||||
|
"that's",
|
||||||
|
"that is",
|
||||||
|
"i think that is",
|
||||||
|
"that fact is",
|
||||||
|
],
|
||||||
|
vec![" "],
|
||||||
|
vec!["somewhat ", "pretty ", "quite ", "very ", "decently ", ""],
|
||||||
|
vec!["fun", "nice", "sweet", "pleasant", "cool", "interesting"],
|
||||||
|
];
|
||||||
|
for selection in choices.into_iter().multi_cartesian_product() {
|
||||||
|
let mut hasher = Sha256::new();
|
||||||
|
for choice in &selection {
|
||||||
|
hasher.update(choice);
|
||||||
|
}
|
||||||
|
let digest = hasher.finalize();
|
||||||
|
if format!("{digest:x}").contains("7777777") {
|
||||||
|
println!("{}", selection.join(""));
|
||||||
|
println!("{digest:x}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue