Socket
Book a DemoInstallSign in
Socket

decaflag

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decaflag

A CLI tool to encode strings into a table and indices.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

decaflag

A CLI tool that encodes strings into a table and indices format, with the ability to decode them back to the original message. The encoded data is stored in a JSON format and can be decoded back to the original message, which is then output in base64 format.

Installation

# Install globally
npm install -g decaflag

# Or run directly with npx
npx decaflag

Usage

Encoding a message

# Using global installation
decaflag "Hello, World!"

# Using npx
npx decaflag "Hello, World!"

This will create a data.json file containing the encoded message.

Decoding a message

# Using global installation
decaflag-decode

# Using npx
npx decaflag-decode

# Using npm script (alternative)
npm run decode

This will read the data.json file and create a flag file containing the decoded message in base64 format.

How it works

The tool works by creating a table of unique characters from the input string and storing their indices. This creates a simple form of encoding that can be easily reversed.

Data Format

The data.json file contains two main components:

  • table: A string containing all unique characters from the input
  • indices: An array of numbers representing positions in the table

Example:

Input:

npx decaflag "hello"

Generated data.json:

{
  "table": "helo\0",
  "indices": [0, 1, 2, 3, 3, 4]
}

When decoded, this will reconstruct "hello" and output it in base64 format.

More examples:

  • Input: npx decaflag "Hello, World!"

    {
      "table": "Helo, Wrd!\0",
      "indices": [0, 1, 2, 2, 3, 4, 5, 6, 3, 7, 2, 8, 9]
    }
    
  • Input: npx decaflag "AABBCC"

    {
      "table": "ABC\0",
      "indices": [0, 0, 1, 1, 2, 2]
    }
    

License

MIT License - See LICENSE file for details.

Keywords

cli

FAQs

Package last updated on 15 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts