Hash.RandomHexString
--------------------

Creates a random hex string.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Hash](component_Hash.md) | [3.3](newinversion33.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Hash.RandomHexString"; Length ) 

**MBS**( **"Hash.RandomHexString";** /\* Creates a random hex string. \*/  
**$Length**) /\* The length of the text to return in characters. Result string with be double that size as it is hex.e.g. 32 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Length | The length of the text to return in characters. Result string with be double that size as it is hex. | 32 |

### Result

Returns text.

### Description

Creates a random hex string.  
You can use this strings for hash seeds.  
### Examples

Creates 8 byte string:

 MBS ( "Hash.RandomHexString"; 8 )  
Create a random password to pass to user:

 Set Variable \[$password ; Value: MBS ( "Hash.RandomHexString"; 16 ) \]  
Create a random password to pass to user:

 Set Variable \[$password ; Value:   
MBS ( "Hash.RandomHexString"; 3 ) &amp; "-" &amp;   
MBS ( "Hash.RandomHexString"; 3 ) &amp; "-" &amp;   
MBS ( "Hash.RandomHexString"; 3 ) \]  
### See also

- [Hash.RandomString](HashRandomString.md)
- [Hash.SHA1](HashSHA1.md)

### Release notes

- **Version 16.3**
    - Improved performance of Hash.RandomHexString function.

### Blog Entries

- [MBS FileMaker Plugin, version 16.3pr2](https://www.mbsplugins.de/archive/2026-06-15/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.3pr1](https://www.mbsplugins.de/archive/2013-05-24/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 23th February 2024

  
[Hash.PBKDF2.HMAC](HashPBKDF2HMAC.md) - [Hash.RandomString](HashRandomString.md)

[HTML Version](HashRandomHexString.shtml)