GithubHelp home page GithubHelp logo

csharp-cipher-cli's Introduction

csharp-cipher-cli

Description

A command-line interface (CLI) tool that allows to encrypt/decrypt data with given key ๐Ÿ”

Try web version! ๐ŸŒ

Usage

1st way

Use cmd to enter commands

See examples folder for more information

application.exe --action "action_value" --key "key_value" --file "C:/path/to/file.txt"
Parameter Value Description
--action encrypt | decrypt select what you want
--key enter yours please dont forget it
--file enter yours path to file (absolute or relative)

Encrypt

cipher-cli.exe --action encrypt --key foobar --file "./showcase.json"

Decrypt

cipher-cli.exe --action decrypt --key foobar --file "./showcase-encrypted.txt"

2nd way

This is kinda password manager tool

Requirements โ€” data stored in special format

  • Run .exe file as regular application
  • File dialogue window will popup
  • Select file with encrypted contents
  • Enter key
  • Use arrow keys (โ†‘, โ†“) to navigate in list of entries
  • Press Enter key to select desired entry
  • It will show description of the entry and associated data (displayed as asterix as it might be sensitive information)
  • Again, use arrow keys to navigate, and select โ€” it will copy that data to clipboard, so you can paste in the future

Special format

[
  {
    "name": "some website",
    "description": "email + password",
    "data": ["[email protected]", "123456"]
  },
  {
    "name": "another website",
    "description": "email + password",
    "data": ["[email protected]", "qwerty123"]
  }
]

How does it works

Step 1. Ask for text and key

Example

  • text โ€” Hello, World!
  • key โ€” 123

Step 2. Convert given text and key from normal string to array of bytes (in utf-8 encoding)

Example

  • text โ€” [72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33]
  • key โ€” [49, 50, 51]

Step 3. Sequentially xor each byte of text with byte of key (in the algorithm key becames normalized to match length)

Example

  • Normalized key: from [49, 50, 51] to [49, 50, 51, 49, 50, 51, 49, 50, 51, 49, 50, 51, 49]
  • Xoring: [72 ^ 49, 101 ^ 50, 108 ^ 51, 108 ^ 49, ...] โ†’ [121, 87, 95, 93, ...]

Step 4. Put xored byte into new array at the corresponding index

Example

  • Output: [121, 87, 95, 93, 93, 31, 17, 101, 92, 67, 94, 87, 16]

Step 5. Convert array of bytes to string (in base64 encoding)

Example

  • Output: eVdfXV0fEWVcQ15XEA==

Step 6. Save output to disk or cloud, DON'T forget the key, otherwise you could not decrypt file ๐Ÿคฌ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.