@cute-dw/core
Version:
This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need
51 lines (50 loc) • 1.95 kB
TypeScript
export type EncodingFormat = "Base64" | "URI";
/**
* This class consists exclusively of the static methods that operate on or return results of the different cipher algorythms
*/
export declare class Ciphers {
private static UUID_V4_PIC;
/**
* Generates UUID ver. 4
* @returns UUID
*/
static uuid_v4(): string;
/**
* Returns the numeric hash value of the some string key
* @param key String value
* @param mapSize A value for modulo division
* @returns Calculated hash value
*/
static keyHash(key: string, mapSize: number): number;
/**
* Gets the hash code of the string just like Java's hashCode() method does
* @param source A string for which you want to get a hash code
* @returns Numeric hash code of the `source`
* @see {@link encode}
*/
static hashCode(source: string): number;
/**
* Calculate a 32 bit FNV-1a hash
* @param {string} source the input value
* @param {integer} [seed] optionally pass the hash of the previous chunk
* @returns Numeric hash code of the `source`
*/
static hashFnv32a(source: string, seed?: number): number;
/**
* Decode string that was encoded in `format`
* @param source Source encoded string
* @param format Encoding format. Default is `Base64`
* @returns Decoded string if succeededs, or an empty string ('') if some error occurs
* @see {@link encode}
*/
static decode(source: string, format?: EncodingFormat): string;
/**
* Encode string to specified format
* @param source Source string to encode
* @param {EncodingFormat} format Encoding format
* @returns Encoded string if succeeded, or an empty string ('') if some error occurs
* @see {@link decode}
* @see {@link hashCode}
*/
static encode(source: string, format?: EncodingFormat): string;
}