new Util()
This object contains utility functions
- Source:
Members
-
bin2str
-
Convert an array of integers(0.255) to a string
- Source:
-
Uint8Array2str
-
Convert a Uint8Array to a string. This currently functions the same as bin2str.
- Source:
Methods
-
calc_checksum(text) → {Integer}
-
Calculates a 16bit sum of a string by adding each character codes modulus 65535
Parameters:
Name Type Description text
String String to create a sum of - Source:
Returns:
An integer containing the sum of all character codes % 65535- Type
- Integer
-
decode_utf8(utf8) → {String}
-
Convert a string of utf8 bytes to a native javascript string
Parameters:
Name Type Description utf8
String A valid squence of utf8 bytes - Source:
Returns:
A native javascript string- Type
- String
-
encode_utf8(str) → {String}
-
Convert a native javascript string to a string of utf8 bytes
Parameters:
Name Type Description str
String The string to convert - Source:
Returns:
A valid squence of utf8 bytes- Type
- String
-
get_hashAlgorithmString() → {String}
-
Return the algorithm type as string
- Source:
Returns:
String representing the message type- Type
- String
-
hex2bin(str) → {String}
-
Create binary string from a hex encoded string
Parameters:
Name Type Description str
String Hex string to convert - Source:
Returns:
String containing the binary values- Type
- String
-
hexidump(str) → {String}
-
Creating a hex string from an binary array of integers (0..255)
Parameters:
Name Type Description str
String Array of bytes to convert - Source:
Returns:
Hexadecimal representation of the array- Type
- String
-
hexstrdump(str) → {String}
-
Create hexstring from a binary
Parameters:
Name Type Description str
String String to convert - Source:
Returns:
String containing the hexadecimal values- Type
- String
-
print_debug(str)
-
Helper function to print a debug message. Debug messages are only printed if openpgp.config.debug is set to true.
Parameters:
Name Type Description str
String String of the debug message - Source:
-
print_debug_hexstr_dump(str)
-
Helper function to print a debug message. Debug messages are only printed if openpgp.config.debug is set to true. Different than print_debug because will call hexstrdump iff necessary.
Parameters:
Name Type Description str
String String of the debug message - Source:
-
print_error(str)
-
Helper function to print an error message.
Parameters:
Name Type Description str
String String of the error message - Source:
-
print_info(str)
-
Helper function to print an info message.
Parameters:
Name Type Description str
String String of the info message - Source:
-
shiftRight(value, bitcount) → {String}
-
Shifting a string to n bits right
Parameters:
Name Type Description value
String The string to shift bitcount
Integer Amount of bits to shift (MUST be smaller than 9) - Source:
Returns:
Resulting string.- Type
- String
-
str2bin(str) → {Array.<Integer>}
-
Convert a string to an array of integers(0.255)
Parameters:
Name Type Description str
String String to convert - Source:
Returns:
An array of (binary) integers- Type
- Array.<Integer>
-
str2Uint8Array(str) → {Uint8Array}
-
Convert a string to a Uint8Array
Parameters:
Name Type Description str
String String to convert - Source:
Returns:
The array of (binary) integers- Type
- Uint8Array