#cli #encrypt #decrypt #masking

app med_cli

A Rust Powered CLI tool for CSV/JSON Masking, Encryption, and Decryption

22 releases (4 breaking)

0.6.4 Jul 8, 2023
0.6.3 Jul 7, 2023
0.6.0 Jun 30, 2023
0.5.9 Jun 25, 2023
0.1.0 May 28, 2023

#210 in Command line utilities

Download history 22/week @ 2023-08-14 22/week @ 2023-08-28 57/week @ 2023-09-04 4/week @ 2023-09-11 14/week @ 2023-09-18 2/week @ 2023-09-25 3/week @ 2023-10-02 16/week @ 2023-10-16 22/week @ 2023-10-30 22/week @ 2023-11-06 1/week @ 2023-11-13 25/week @ 2023-11-20 68/week @ 2023-11-27

116 downloads per month



Crates.io Actions Status codecov Crates.io

M.E.D. (Mask, Encrypt, Decrypt) - a RUST powered CLI tool for CSV/JSON files.

Background & Motivation

This is a personal hobby project; based on the observation, sometimes we need a simple enough CLI tool with auditable capability for Data Masking/Encyption/Decryption for CSV/JSON files.

Key Features

  1. Rust powered performance.
  2. Provide Masking, and Encyption/Decryption capabilities.
  3. Auditable with build-in SQLite powered Audit table.


Download from github release

The binary name for M.E.D. is med, it depends on the med_core.

Archives of precompiled binaries for med are available for Windows, macOS and Linux. Users of platforms not explicitly mentioned below are advised to download one of these archives.

Fedora and Centos

dnf install med


$ med --help
A simple to use, enterprise ready, rust powered data masking/encryption/decription cli tool

Usage: med <MODE> --file <FILE> [OPTIONS]

          What mode to run the program in
          Possible values:
          - mask:    Mask the data by *
          - encrypt: Encrypt the data with provided KEY
          - decrypt: Decrypt the data with provided KEY

  -t, --type <TYPE> type of file we will process, available option [csv, json] [default: csv]
  -k, --key <KEY> key for Encrypt and Decrypt the file.
  -s, --standard <STANDARD> set the Encrypt and Decrypt standard
        Possible values:
          - des64:  DES standard 64
          - aes128: AES standard 128
          - aes192: AES standard 192
          - aes256: AES standard 256
  -f, --file <FILE> file path for the
  -c, --config <CONFIG> Sets a custom config yml path [default: conf.yaml]
  -o, --output <OUTPUT> Sets a file/directory path for output [default: output]
  -d, --debug <DEBUG> Sets debug flag [possible values: true, false]
  -w, --worker <WORKER> Sets work flag
  -h, --help Print help (see a summary with '-h')
  -V, --version Print version

User Guide


The configuration file can be any given name of yaml file.

// example of the conf.yaml
mask_symbols: "#####" # mask symbols
fields: # list of the cols/fields you want to mask 
  - name
  - email
  - phone

Example of how to

  1. All the demo data are available in the package when you download it. And it's all RANDOMLY generated. csv json
  2. You only need to point to the root dir for your files. M.E.D. will take care of the rest.
// mask the csv files in folders
med mask -f demo/data/csv -c demo/conf/conf_csv.yaml -w 3

// mask the json files in folders
med mask -t json -f demo/data/json -c demo/conf/conf_json.yaml -w 3

// encrypt the csv files 
med encrypt -f demo/data/csv -c demo/conf/conf_csv.yaml -w 4 -k YOUR_SECRET -s des64

// decrypt the json files 
med decrypt -t json -f output/demo/data/json -c demo/conf/conf_json.yaml -w 5 -k YOUR_SECRET -s des64

Audit database (Sqlite)

M.E.D. uses SQLite for the audit capture, mainly ensuring following the Entreprise level Audit base standard, capture, Who, When, Where(which machine), do what, and status, etc.

The metadata and migration are available here.

The audit db location will be different depending on your OS.

Platform Value Example
Linux $HOME/.config/med /home/bob/.config/med
MacOS $HOME/Library/Application Support/med /Users/Bob/Library/Application Support/med
Windows {FOLDERID_RoamingAppData}/med C:\Users\Bob\AppData\Roaming\med

database migration

We prepare the database migration capabilites and this migrations folder NEED to be in the same directoy of your binary.


~1M SLoC