npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@provassure/special-encrypt

v1.0.1

Published

A comprehensive encoding/decoding library that supports multiple encoding types in a single unified interface.

Readme

Special Encrypt Library

A comprehensive encoding/decoding library that supports multiple encoding types in a single unified interface.

Features

  • Universal Encoder: Single method for multiple encoding types
  • Special Character Encryption: Custom token-based encoding for special characters
  • Multiple Encoding Types: Base64, Hex, Binary, URL, HTML entities, ROT13, Caesar cipher, and custom encoding
  • Detection: Built-in methods to detect encoded strings
  • Flexible Options: Support for custom parameters (e.g., Caesar cipher shift)

Installation

npm install @provassure/special-encrypt

Usage

Basic Usage

const { encode, decode, process, getSupportedTypes } = require('@provassure/special-encrypt');

// Encode a string
const encoded = encode("Hello World!", "base64");
console.log(encoded); // "SGVsbG8gV29ybGQh"

// Decode a string
const decoded = decode(encoded, "base64");
console.log(decoded); // "Hello World!"

// Using the process method
const result = process("Hello World!", "base64", "encode");
const original = process(result, "base64", "decode");

Supported Encoding Types

  1. base64 - Standard Base64 encoding
  2. hex - Hexadecimal encoding
  3. binary - Binary representation
  4. url - URL encoding
  5. html - HTML entity encoding
  6. rot13 - ROT13 substitution cipher
  7. caesar - Caesar cipher (configurable shift)
  8. custom - Custom special character encoding

Examples

Base64 Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hello World! @#$%";
const encoded = encode(text, "base64");
const decoded = decode(encoded, "base64");

console.log(encoded); // "SGVsbG8gV29ybGQhICNAJCQl"
console.log(decoded); // "Hello World! @#$%"

Hex Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hello World!";
const encoded = encode(text, "hex");
const decoded = decode(encoded, "hex");

console.log(encoded); // "48656c6c6f20576f726c6421"
console.log(decoded); // "Hello World!"

Binary Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hi";
const encoded = encode(text, "binary");
const decoded = decode(encoded, "binary");

console.log(encoded); // "0100100001101001"
console.log(decoded); // "Hi"

URL Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hello World! @#$%";
const encoded = encode(text, "url");
const decoded = decode(encoded, "url");

console.log(encoded); // "Hello%20World!%20%40%23%24%25"
console.log(decoded); // "Hello World! @#$%"

HTML Entity Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hello & World < > \" ' ©";
const encoded = encode(text, "html");
const decoded = decode(encoded, "html");

console.log(encoded); // "Hello &amp; World &lt; &gt; &quot; &#39; &copy;"
console.log(decoded); // "Hello & World < > \" ' ©"

ROT13 Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hello World!";
const encoded = encode(text, "rot13");
const decoded = decode(encoded, "rot13");

console.log(encoded); // "Uryyb Jbeyq!"
console.log(decoded); // "Hello World!"

Caesar Cipher

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Hello World!";
const encoded = encode(text, "caesar", { shift: 5 });
const decoded = decode(encoded, "caesar", { shift: 5 });

console.log(encoded); // "Mjqqt Btwqi!"
console.log(decoded); // "Hello World!"

Custom Special Character Encoding

const { encode, decode } = require('@provassure/special-encrypt');

const text = "Where is the file @ path /docs . fr ?";
const encoded = encode(text, "custom");
const decoded = decode(encoded, "custom");

console.log(encoded); // "Where is the file _sc40_ path _sc47_docs _sc46_ fr _sc63_"
console.log(decoded); // "Where is the file @ path /docs . fr ?"

Advanced Usage

Get Supported Types

const { getSupportedTypes } = require('@provassure/special-encrypt');

const types = getSupportedTypes();
console.log(types); // ["base64", "hex", "binary", "url", "html", "rot13", "caesar", "custom"]

Detect Encoded Strings

const { isEncoded } = require('@provassure/special-encrypt');

console.log(isEncoded("SGVsbG8gV29ybGQh", "base64")); // true
console.log(isEncoded("48656c6c6f20576f726c6421", "hex")); // true
console.log(isEncoded("Hello World!", "base64")); // false

Using the Process Method

const { process } = require('@provassure/special-encrypt');

// Encode
const encoded = process("Hello World!", "base64", "encode");

// Decode
const decoded = process(encoded, "base64", "decode");

// With options (for Caesar cipher)
const caesarEncoded = process("Hello", "caesar", "encode", { shift: 3 });
const caesarDecoded = process(caesarEncoded, "caesar", "decode", { shift: 3 });

Legacy Special Character Encryption

The library also includes the original special character encryption methods:

const { encryptSpecialChars, decryptSpecialChars } = require('@provassure/special-encrypt');

const text = "Where is the file @ path /docs . fr ?";
const encrypted = encryptSpecialChars(text);
const decrypted = decryptSpecialChars(encrypted);

console.log(encrypted); // "Where is the file _sc40_ path _sc47_docs _sc46_ fr _sc63_"
console.log(decrypted); // "Where is the file @ path /docs . fr ?"

API Reference

Main Functions

  • encode(input, type, options) - Encode a string using specified type
  • decode(input, type, options) - Decode a string using specified type
  • process(input, type, action, options) - Universal encode/decode method
  • getSupportedTypes() - Get list of supported encoding types
  • isEncoded(input, type) - Test if a string is encoded with a specific type

Legacy Functions

  • encryptSpecialChars(input) - Encrypt special characters with custom tokens
  • decryptSpecialChars(input) - Decrypt special character tokens

Options

  • Caesar Cipher: { shift: number } - Specify the shift value (default: 3)
  • Other encodings: No additional options required

Error Handling

The library throws descriptive errors for unsupported encoding types or invalid actions:

try {
  const result = encode("Hello", "unsupported");
} catch (error) {
  console.log(error.message); // "Unsupported encoding type: unsupported. Supported types: base64, hex, binary, url, html, rot13, caesar, custom"
}

Testing

Run the test file to see all encoding types in action:

node test-universal.js

License

MIT