UNPKG

node-fnr

Version:

Format-preserving encryption (FPE), small cipher (< 128 bits), for anonymization.

29 lines (28 loc) 1.3 kB
/// <reference types="node" /> declare class Fnr { /** * Inicialize FCR cipher. * @param data_bitsize Size of data pieces to en/decrypt in bits. Must be between 1 and 128 (inclusive). * @param passwd_bitsize Size of the secret password in bits. 128, 192 or 256. * @param tweak_bytesize Size of the possibly public tweak in bytes. */ constructor(data_bitsize: number, passwd_bitsize: 128 | 192 | 256, tweak_bytesize: number); /** * Encrypt data by the FCR cipher. * @param data Buffer of the data to encrypt (in place). * @param passwd Buffer of the secret password. * @param tweak_str Buffer of the possibly public tweak. * @param data_count Number of the data pieces to encrypt in the `data` buffer. */ encrypt(data: Buffer, passwd: Buffer, tweak_str: Buffer, data_count: number): void; /** * Decrypt data by the FCR cipher. * @param data Buffer of the data to decrypt (in place). * @param passwd Buffer of the secret password. * @param tweak_str Buffer of the possibly public tweak. * @param data_count Number of the data pieces to decrypt in the `data` buffer. */ decrypt(data: Buffer, passwd: Buffer, tweak_str: Buffer, data_count: number): void; private _addonInstance; } export = Fnr;