TOTP.EncodeToBase32
-------------------

Encode a base32 string.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [TOTP](component_TOTP.md) | [13.4](newinversion134.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "TOTP.EncodeToBase32"; Text { ; Encoding } ) 

**MBS**( **"TOTP.EncodeToBase32";** /\* Encode a base32 string. \*/  
**$Text**; /\* The text to process.e.g. "Hello World" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is UTF-8.e.g. "UTF-8" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The text to process. | "Hello World" |  |
| Encoding | The text encoding for text parameter.    Default is UTF-8. | "UTF-8" | Optional |

### Result

Returns encoded text or error.

### Description

Encode a base32 string.  
Please check what text encoding you want to use. Especially what the software processing the base32 string expects.  
Based on RFC 3548 and RFC 4648.  
### Examples

Encode Hello

 MBS ( "TOTP.EncodeToBase32"; "Hello World")  
<small>  
Example result: JBSWY3DPEBLW64TMMQ======</small>Encode test string:

 MBS ( "TOTP.EncodeToBase32"; "The quick brown fox jumps over the lazy dog.")  
<small>  
Example result: KRUGKIDROVUWG2ZAMJZG653OEBTG66BANJ2W24DTEBXXMZLSEB2GQZJANRQXU6JAMRXWOLQ=</small>### See also

- [Text.EncodeToBase64](TextEncodeToBase64.md)
- [TOTP.DecodeFromBase32](TOTPDecodeFromBase32.md)

### Release notes

- **Version 13.4**
    - Added [TOTP.DecodeFromBase32](https://www.mbsplugins.eu/TOTPDecodeFromBase32.shtml) and [TOTP.EncodeToBase32](https://www.mbsplugins.eu/TOTPEncodeToBase32.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin, version 13.4pr3](https://www.mbsplugins.de/archive/2023-08-16/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 16th August 2023 , last changed 7th April 2025

  
[TOTP.DecodeFromBase32](TOTPDecodeFromBase32.md) - [Text.AddLineNumbers](TextAddLineNumbers.md)

[HTML Version](TOTPEncodeToBase32.shtml)