Skip to content

str2hex(cStr) - String to Hexadecimal Conversion in Merciglobal Cloud ERP

The str2hex(cStr) function is a custom JavaScript utility provided by Merciglobal Cloud ERP to convert a regular string into its hexadecimal representation. This function is particularly useful for internal encoding, secure transmission of data, and storage purposes.


Function Signature

str2hex(cStr: string): string

Parameters

Name Type Description
cStr string The string that needs to be encoded into hexadecimal format.

Return Value

  • Returns a string representing the hexadecimal format of the input.

Usage Example

let original = "MerciERP";
let hexEncoded = str2hex(original);
console.log(hexEncoded);
// Output: 4d65726369455250

Common Use Cases

  • Encrypting sensitive metadata for safe transmission
  • Debugging and troubleshooting data flow within modules
  • Converting input strings before storing in secure tables

Developer Notes

  • Always validate the input to ensure it's a valid string.
  • This function does not perform encryption — it's a simple encoding utility.
  • Ensure reverse conversion utility (hex2str) is available if required.

Security Implication

While str2hex helps obscure data, it should not be used as a secure encryption mechanism. Use this only for basic encoding purposes in non-critical layers.


Pricing Impact

Feature Included in Plan Additional Cost
String to Hex Utility ✅ All Plans ❌ No Extra Cost

Need Help?

Reach out to the Merciglobal Cloud ERP support team or internal documentation portal for implementation patterns, best practices, or issues with encoding utilities.


🧠 Internal Use Only: Make sure to standardize its usage across ERP modules to maintain uniformity.