Hex

Hex object is used to encode/decode text/binary in hexadecimal format.

Version 4.x

Basic Usage

var hex = require("utils/v4/hex");
var response = require("http/v4/response");

response.println(hex.encode("Hex Encoded"));
response.println(hex.decode("48657820456e636f646564"));

response.flush();
response.close();

Definition

Functions


Function Description Returns
decode(input) Decode an input string from HEX string
encode(input) Encode an input string to HEX string

Compatibility

Rhino Nashorn V8 Graal

Version 3.x

Basic Usage

var hex = require("utils/v3/hex");
var response = require("http/v3/response");

response.println(hex.encode("Hex Encoded"));
response.println(hex.decode("48657820456e636f646564"));

response.flush();
response.close();

Definition

Functions


Function Description Returns
decode(input) Decode an input string from HEX string
encode(input) Encode an input string to HEX string

Compatibility

Rhino Nashorn V8

Version 2.x

Basic Usage

/* globals $ */
/* eslint-env node, dirigible */

var hex = require('utils/hex');
var response = require('net/http/response');

response.println(hex.encode('Hex Encoded'));
response.println(hex.decode('48657820456e636f646564'));

response.flush();
response.close();

Definition

Functions


Function Description Returns
decode(input) Decode an input string from HEX string
encode(input) Encode an input string to HEX string

Compatibility

Rhino Nashorn V8

Edit