Compare commits
2 commits
1f2c630f3b
...
a4d2a3208b
Author | SHA1 | Date | |
---|---|---|---|
Yash Karandikar | a4d2a3208b | ||
Yash Karandikar | 1e31340583 |
26
cryptrs/README.md
Normal file
26
cryptrs/README.md
Normal 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>
|
||||
|
|
@ -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() {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue