2020-04-24 16:11:32 +02:00
|
|
|
/**
|
|
|
|
* encode a string to base64
|
|
|
|
*
|
|
|
|
* @param {string} str string to encode
|
|
|
|
* @param {string} encoding encoding the string is in
|
|
|
|
* @returns {string} base64
|
|
|
|
*/
|
|
|
|
export function to_b64(str: string, encoding?: string): string;
|
|
|
|
/**
|
|
|
|
* encode a string to hex
|
|
|
|
*
|
|
|
|
* @param {string} str string to encode
|
|
|
|
* @param {string} encoding encoding the string is in
|
|
|
|
* @returns {string} hex
|
|
|
|
*/
|
|
|
|
export function to_hex(str: string, encoding?: string): string;
|
|
|
|
/**
|
|
|
|
* encode a string to utf-8
|
|
|
|
*
|
|
|
|
* @param {string} str string to encode
|
|
|
|
* @param {string} encoding encoding the string is in
|
|
|
|
* @returns {string} utf-8
|
|
|
|
*/
|
|
|
|
export function to_utf8(str: string, encoding: string): string;
|
|
|
|
/**
|
|
|
|
* encode a number to hex
|
|
|
|
*
|
|
|
|
* @param {number} n number to encode
|
2020-04-24 16:59:23 +02:00
|
|
|
* @param {number} padding minumum length of output
|
2020-04-24 16:11:32 +02:00
|
|
|
* @returns {string} hex
|
|
|
|
*/
|
2020-04-24 16:59:23 +02:00
|
|
|
export function num_to_hex(n: number, padding?: number): string;
|
2020-04-24 16:11:32 +02:00
|
|
|
/**
|
|
|
|
* decode a number from hex
|
|
|
|
*
|
|
|
|
* @param {string} h hex to decode
|
|
|
|
* @returns {number} number
|
|
|
|
*/
|
|
|
|
export function hex_to_num(h: string): number;
|