Compare commits

...

2 commits

Author SHA1 Message Date
Yash Karandikar a4d2a3208b Rustfmt 2022-01-19 11:15:30 -06:00
Yash Karandikar 1e31340583 Add README.md 2022-01-19 11:14:54 -06:00
2 changed files with 32 additions and 7 deletions

26
cryptrs/README.md Normal file
View file

@ -0,0 +1,26 @@
# CryptRS
[Live App](https://etc.karx.xyz/rgl/cryptrs)
## Implementation details
This app uses Rust's type system to easily convert between characters and numeric types. After that, it's just a simple Vignere table lookup and then conversion back to a numeric type.
## Running Locally
1. Install dependencies
First, install `rust` from [the Rust website](https://www.rust-lang.org/). Then, install `trunk`:
```bash
cargo install --locked trunk
```
This project requires `rustc` version `1.57.0 stable` because it uses the 2021 edition of Rust!
2. Build project
```bash
cd /path/to/cryptrs
trunk serve
```
3. Open in browser
[Check the supported browser list](https://rustwasm.github.io/docs/wasm-bindgen/reference/browser-support.html) and open https://localhost:8080 in one of the supported browsers.
<small>Created using [Sycamore](https://crates.io/crates/sycamore) and Rust with WebAssembly</small>

View file

@ -1,5 +1,5 @@
use sycamore::prelude::*;
use std::panic;
use sycamore::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
@ -10,7 +10,7 @@ extern "C" {
enum AppMode {
Encrypt,
Decrypt
Decrypt,
}
#[component(EncryptionComponent<G>)]
@ -19,7 +19,6 @@ fn encryption_component() -> View<G> {
let input = Signal::new(String::new());
let no_key = Signal::new(false);
let crypted = create_memo(cloned!((keyword, input, no_key) => move || {
let keyword = &**keyword.get();
@ -51,10 +50,10 @@ fn encryption_component() -> View<G> {
}
generated
}));
}));
view! {
label { "Keyword:"
label { "Keyword:"
input(bind:value=keyword)
}
label { "Input:"
@ -78,7 +77,7 @@ fn decryption_component() -> View<G> {
let keyword = Signal::new(String::new());
let input = Signal::new(String::new());
let no_key = Signal::new(false);
let decrypted = create_memo(cloned!((keyword, input, no_key) => move || {
let keyword = &**keyword.get();
@ -154,4 +153,4 @@ fn main() {
}
}
});
}
}