UNPKG

dcoderz-encryption

Version:

Cross-platform encryption library with JavaScript and Python compatibility. Features custom cipher algorithms with character substitution, matrix transformations, and integrity verification.

73 lines (65 loc) 2.32 kB
declare module 'dcoderz-encryption' { /** * Dcoderz Encryption Engine * * A proprietary encryption algorithm that combines multiple layers of security: * 1. Dynamic character substitution using a seed-based cipher wheel * 2. Matrix transformation with row/column scrambling * 3. Position-based XOR operations * 4. Multi-layered encoding with checksums */ export class CipherEngine { /** * Initialize the cipher engine with a master key * @param masterKey - The encryption key */ constructor(masterKey: string); /** * Encrypt plaintext using the Dcoderz cipher engine * @param plaintext - The text to encrypt * @returns The encrypted text */ encrypt(plaintext: string): string; /** * Decrypt ciphertext using the Dcoderz cipher engine * @param ciphertext - The encrypted text to decrypt * @returns The decrypted text */ decrypt(ciphertext: string): string; } /** * Convenience function to encrypt text with a key * @param plaintext - The text to encrypt * @param key - The encryption key * @returns The encrypted text */ export function encrypt(plaintext: string, key: string): string; /** * Convenience function to decrypt text with a key * @param ciphertext - The encrypted text to decrypt * @param key - The decryption key * @returns The decrypted text */ export function decrypt(ciphertext: string, key: string): string; /** * Generate a random encryption key * @param length - The length of the key (default: 32) * @returns A random key */ export function generateKey(length?: number): string; /** * Check if a string is a valid encrypted text * @param ciphertext - The text to validate * @returns True if valid, false otherwise */ export function isValidCiphertext(ciphertext: string): boolean; // Legacy compatibility /** * @deprecated Use encrypt() instead */ export function encryptText(plaintext: string, key: string): string; /** * @deprecated Use decrypt() instead */ export function decryptText(ciphertext: string, key: string): string; }