https://github.com/animesh-ghosh/crypt
A WebAssembly toy project.
https://github.com/animesh-ghosh/crypt
cipher cipher-algorithms cpp cpp11 emscripten make makefile webassembly
Last synced: about 2 months ago
JSON representation
A WebAssembly toy project.
- Host: GitHub
- URL: https://github.com/animesh-ghosh/crypt
- Owner: Animesh-Ghosh
- License: gpl-3.0
- Created: 2020-04-22T18:15:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-30T09:10:35.000Z (almost 5 years ago)
- Last Synced: 2025-02-07T09:44:51.092Z (3 months ago)
- Topics: cipher, cipher-algorithms, cpp, cpp11, emscripten, make, makefile, webassembly
- Language: C++
- Size: 27.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Crypt
A WebAssembly toy project.
Implement cryptographic ciphers and use them in a web-app them to encrypt/decrypt simple texts.
**Ciphers implemented currently cannot be used to decrypt a given cipher text. Currently only encrypting plain-text and getting back the plain-text works.**
*Prerequisites: Need a C++11 compliant compiler (and related toolchain) and Emscripten toolchain. You can get the Emscripten toolchain from [here](https://github.com/emscripten-core/emsdk).*
## Building and Running
Developed using MinGW toolchain for native build. For WebAssembly, use emscripten (64-bit).
**Native:**
```pwsh
make
```**WebAssembly:**
1. Activate emscripten
2. Run:
```pwsh
em++ --bind web-bindings.cpp ciphers.cpp -I. -std=c++11 -Wall -Wextra -pedantic -o ciphers.html
```
*Note: You can specify em++ to either generate only the JS file which loads the WASM module or you can use Emscripten's generated HTML.*3. Serve the output files and play around with the API in the browser (either Node or Python's http.server module works).
**For Python:**
```pwsh
python -m http.server --bind 127.0.0.1
```**JS API:**
Classes are attached to the `Module` object. Refer to constructor declarations in `ciphers.hpp`. To use the classes:
```js
let cipher = new Module.RailFence("come home");
cipher.Encrypt(); // "cm oeoehm"
cipher.Decrypt(); // "come home"
```**TODOs:**
- [x] Create an interface (probably with Vue.js)
- [x] Write some tests