initial commit

This commit is contained in:
N33R
2025-08-17 20:02:00 +02:00
commit 11ae7946c1
7 changed files with 239 additions and 0 deletions
Generated
+157
View File
@@ -0,0 +1,157 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "bitflags"
version = "2.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"
[[package]]
name = "cfg-if"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "getrandom"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"wasi",
]
[[package]]
name = "libc"
version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "otp"
version = "0.1.0"
dependencies = [
"rand",
]
[[package]]
name = "ppv-lite86"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
dependencies = [
"zerocopy",
]
[[package]]
name = "proc-macro2"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "rand"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
dependencies = [
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
"getrandom",
]
[[package]]
name = "syn"
version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "wasi"
version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
"wit-bindgen-rt",
]
[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags",
]
[[package]]
name = "zerocopy"
version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "otp"
version = "0.1.0"
edition = "2024"
[dependencies]
rand = "0.9.0"
View File
+28
View File
@@ -0,0 +1,28 @@
extern crate rand;
use std::io;
use rand::distr::{Alphabetic, SampleString};
// take one uppercase alphabetic character and return it's alphabetic position (A = 1, B = 2, ...)
// if the letter is not an uppercase alphabetic character, it returns 0.
fn letter_to_number(letter : char) -> usize {
let mut index : usize = 0;
for (i, l) in String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZ").chars().enumerate() {
if l == letter {
index = i + 1;
}
}
return index;
}
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input);
let input_uppercase : String = input.trim().to_uppercase();
let random_string = Alphabetic.sample_string(&mut rand::rng(), input.chars().count()).to_uppercase();
let input_vector: Vec<char> = input_uppercase.chars().collect();
let random_vector: Vec<char> = random_string.chars().collect();
dbg!(input_vector,random_vector);
}
+1
View File
@@ -0,0 +1 @@
n33r@nymph.98565:1755396360
+27
View File
@@ -0,0 +1,27 @@
extern crate rand;
use std::io;
use rand::distr::{Alphabetic, SampleString};
// take one uppercase alphabetic character and return it's alphabetic position (A = 1, B = 2, ...)
// if the letter is not an uppercase alphabetic character, it returns 0.
fn letter_to_number(letter : char) -> usize {
let mut index : usize = 0;
for (i, l) in String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZ").chars().enumerate() {
if l == letter {
index = i + 1;
}
}
return index;
}
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input);
let input_uppercase : String = input.trim().to_uppercase();
let random_string = Alphabetic.sample_string(&mut rand::rng(), input.chars().count()).to_uppercase();
let input_vector: Vec<char> = input_uppercase.chars().collect();
let random_vector: Vec<char> = random_string.chars().collect();
dbg!(input_vector,random_vector);
}
+19
View File
@@ -0,0 +1,19 @@
extern crate rand;
use std::io;
use rand::distr::{Alphabetic, SampleString};
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input);
let mut input_uppercase = input.to_uppercase();
let mut input_uppercase_nonewline = input_uppercase.trim();
let random_string = Alphabetic.sample_string(&mut rand::rng(), input_uppercase_nonewline.chars().count()).to_uppercase();
let input_vector: Vec<char> = input_uppercase_nonewline.chars().collect();
dbg!(input_vector);
}