Skip to content

Encoding Functions

In Spectrum encoding functions allow you to encode and decode strings from decimal to hexadecimal, change text from a string to a hexadecimal representation, and perform other encoding actions.

The following encoding functions are available in Spectrum:

DEC2HEX#

Syntax#

DEC2HEX(<integer>)

Description#

Hexadecimal numbers are base 16 and are represented by the numbers 0-9 and the letters a-f. DEC2HEX converts a decimal number to a hexadecimal number. Only integers can be converted and are displayed as strings.

Examples
Column1 DEC2HEX returns
44 2c
75 4b
95 5f
55 37

DEC_BASE64#

Syntax#

DEC_BASE64(<string>)

Description#

Base64 are similar encoding schemes for representing binary data as ASCII characters. DEC_BASE64 decodes an encoded string to plain text.

Examples
Column1 DEC_BASE64 returns
VW5pdGVkIFN0YXRlcw== United States
QmVsaXpl Belize
SmFwYW4= Japan

ENC_BASE64#

Syntax#

ENC_BASE64(<string>)

Description#

Base64 are similar encoding schemes for representing binary data as ASCII characters. ENC_BASE64 encodes plaintext as a string.

Examples
Column1 ENC_BASE64 returns
United States VW5pdGVkIFN0YXRlcw==
Belize QmVsaXpl
Japan SmFwYW4=

HEX2DEC#

Syntax#

HEX2DEC(<string>)

Description#

Hexadecimal numbers are base 16 and are represented by the numbers 0-9 and the letters a-f. HEX2DEC converts a hexadecimal number given as string to an integer.

Examples
Column1 HEX2DEC returns
2c 44
4b 75
5f 95
37 55

IP_TO_NUMBER#

Syntax#

IP_TO_NUMBER(<string>)

Description#

IPv4 addresses are normally represented in blocks of 8 bits separated by decimal points (known as dot-decimal notation). IP_TO_NUMBER converts IPv4 addresses to an integer between 0 and 4294967295.

Examples
Column1 IP_TO_NUMBER returns
212.122.43.61 3564776253
140.211.11.131 2362641283
255.255.255.255 4294967295
0.0.0.0 0

MD5#

Syntax#

MD5(<any>)

Description#

Returns the MD5 hash value of an argument. MD5 hash values are represented as 32-digit hexadecimal numbers.

Examples
Column1 MD5 returns
Andreas cac58b5234e1f98b4c956998b8ac2e26
Dagmar cac58b5234e1f98b4c956998b8ac2e26
Marko 7a2df5ac764bc2ee72a11ce57c49851c
Peter 6fa95b1427af77b3d769ae9cb853382f
Stefan 752b048c76633399b04f6e87a8b211ca

NUMBER_TO_IP#

Syntax#

NUMBER_TO_IP(<integer>)

Description#

IPv4 addresses are normally represented in blocks of 8 bits separated by decimal points (known as dot-decimal notation). NUMBER_TO_IP converts an integer between 0 and 4294967295 to an IPv4 addresses in dot-decimal notation returned as a string.

Examples
Column1 IP_TO_NUMBER returns
3564776253 212.122.43.61
2362641283 140.211.11.131
4294967295 255.255.255.255
0 0.0.0.0

SHA_1#

Syntax#

SHA_1(<any>)

Description#

Returns the SHA-1 hash value of an argument. SHA-1 hash values are represented as 40-digit hexadecimal numbers.

Examples
Column1 SHA_1 returns
Andreas 60d795ac720deb5b29ab44f3a690a90ddf147d75
Dagmar 69c73eb5084d80a8ae37921d6ed84f56e4144db3
Marko 121e10d11cc93e449c38eec8777fc8f45fbfb24f
Peter 64ca93f83bb29b51d8cbd6f3e6a8daff2e08d3ec
Stefan 64ca93f83bb29b51d8cbd6f3e6a8daff2e08d3ec

SHA_256#

Syntax#

SHA_256(<any>)

Description#

Returns the SHA-256 hash value of an argument. SHA-256 hash values are represented as 64-digit hexadecimal numbers.

Examples
Column1 SHA_256 returns
Andreas 9eea6242471f9b3999f21c6fe247679cab1eae0b6e8431a3a1a5faadb27051c8
Dagmar cda25d356b7a056f5160526291dc65fee857fefe2cd9643f37eeb317cfcca6ce
Marko 48cf6c91c1d1eb864e1d7d6d38e65e6c02249083aca96740ba82f2f123a18177
Peter ea72c79594296e45b8c2a296644d988581f58cfac6601d122ed0a8bd7c02e8bf
Stefan 0d80da802094e4abd5ed8612c725faf64f70f471c2e26778ff91a6a3e4c88597

SHA_384#

Syntax#

SHA_384(<any>)

Description#

Returns the SHA-384 hash value of an argument. SHA-384 hash values are represented as 96-digit hexadecimal numbers.

Examples
Column1 SHA_384 returns
Andreas 172847d3d5dd480cc1286579ba04c5a0d9288a8d1a49f4f1e874cdaf5976486509aecf966cc2c6549c39833e6168ea0c
Dagmar 2d16aab2dd6ccd6ffecb6eec7687ebdebaf19f58e7f9242c37a7903422b7b07f4487704f3ccb5c08dd9142ccd91c22ee
Marko 6d60bf4548c301e4dec9010068d62f1def587033ed1d416e48d60dcfbc2ee7194495eea4f5d11c413a455ec7f15fc88e
Peter a7c6b15d654773ecaf942487ed68453c709108f42026ec9428bdaa8346a1da64741b20b98f87e3f7facb108113a1d4de
Stefan a7c6b15d654773ecaf942487ed68453c709108f42026ec9428bdaa8346a1da64741b20b98f87e3f7facb108113a1d4de

SHA_512#

Syntax#

SHA_512(<any>)

Description#

Returns the SHA-512 hash value of an argument. SHA-512 hash values are represented as 128-digit hexadecimal numbers.

Examples
Column1 SHA_512 returns
Andreas 40d8539300b538acaa4e3e191db174bb91158ef0ffd821df86fa5d54a6cf64d693a229d0d9c4ebd6395d198d873c93209e4915b39e48e30a58bcd6f2d73d4ea0
Dagmar a04da180dc1aee210e44a98626a01d530d3f4ecbd8622ccaddc09fe5c73f0af49c2fc6204d4abe29fbc76fc361ebb4a046ec14ce506ca149fab2986541594792
Marko 30117fcaef2f7d523faf47801131eff244d8318debfa27ab206e07653e376e1101feed8dcb72e8faf3f60e087123bf7dda239675cdb349b06d6e5c583bc8678e
Peter 2b3ec4e18dd2d60837d7aa369838192b72ad00a5ed2b494df3b20350c2a0db6c7f35c32fb1bd2bfaa76bcf6a17111a7641caa940d8eaf4726e47b27909cc0f4c
Stefan b10258228665e1067b246ad4c2ce9f92bf498c339e23dbcbad09a4e633ac9a5cfdd14fa7258ae70cfe29f15c60a78b99d8508fc707b3f0ab0496d011e05aa11d

TEXT2HEX#

Syntax#

TEXT2HEX(<string>;<number>;<string>)

Description#

TEXT2HEX returns each character's unicode value represented in hexadecimal. The second argument (optional) indicates after how many characters a delimiter should appear in the hexadecimal representation - the default is zero. The third argument indicates which character(s) should be used as a delimiter. The default delimiter is a hyphen (-).

Examples
| Column1 | argument1 | argument2 | TEXT2HEX returns |
|:--------|:----------|:----------|:-----------------|
| Hello   |           |           | 48656c6c6f       |
| Hello   | 2         |           | 48-65-6c-6c-6f   |
| Hello   | 3         |           | 486-56c-6c6-f    |
| Hello   | 2         | /         | 48/65/6c/6c/6f   |