---
title: New cryptographic functions — encode_base64() and sha256()
description: Rulesets now support encode_base64() and sha256() functions for generating signed request headers directly in expressions.
image: https://developers.cloudflare.com/changelog-preview.png
---

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/changelog/llms.txt  
> Use this file to discover all available pages before exploring further. 

[Skip to content](#%5Ftop) 

# Changelog

New updates and improvements at Cloudflare.

[ Subscribe to RSS ](https://developers.cloudflare.com/changelog/rss/index.xml) [ View RSS feeds ](https://developers.cloudflare.com/fundamentals/new-features/available-rss-feeds/) 

![hero image](https://developers.cloudflare.com/_astro/hero.CVYJHPAd_26AMqX.svg) 

[ ← Back to all posts ](https://developers.cloudflare.com/changelog/) 

## New cryptographic functions — encode\_base64() and sha256()

Jan 22, 2026 

[ Rules ](https://developers.cloudflare.com/rules/) 

Cloudflare Rulesets now includes `encode_base64()` and `sha256()` functions, enabling you to generate signed request headers directly in rule expressions. These functions support common patterns like constructing a canonical string from request attributes, computing a SHA256 digest, and Base64-encoding the result.

---

#### New functions

| Function                     | Description                                                                                                                                                                                                                                             | Availability                          |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| encode\_base64(input, flags) | Encodes a string to Base64 format. Optional flags parameter: u for URL-safe encoding, p for padding (adds \= characters to make the output length a multiple of 4, as required by some systems). By default, output is standard Base64 without padding. | All plans (in header transform rules) |
| sha256(input)                | Computes a SHA256 hash of the input string.                                                                                                                                                                                                             | Requires enablement                   |

Note

The `sha256()` function is available as an Enterprise add-on and requires a specific entitlement. Contact your account team to enable it.

---

#### Examples

**Encode a string to Base64 format:**

```txt
encode_base64("hello world")
```

Returns: `aGVsbG8gd29ybGQ`

**Encode a string to Base64 format with padding:**

```txt
encode_base64("hello world", "p")
```

Returns: `aGVsbG8gd29ybGQ=`

**Perform a URL-safe Base64 encoding of a string:**

```txt
encode_base64("hello world", "u")
```

Returns: `aGVsbG8gd29ybGQ`

**Compute the SHA256 hash of a secret token:**

```txt
sha256("my-token")
```

Returns a hash that your origin can validate to authenticate requests.

**Compute the SHA256 hash of a string and encode the result to Base64 format:**

```txt
encode_base64(sha256("my-token"))
```

Combines hashing and encoding for systems that expect Base64-encoded signatures.

For more information, refer to the [Functions reference](https://developers.cloudflare.com/ruleset-engine/rules-language/functions/).

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://developers.cloudflare.com/changelog/post/2026-01-22-sha256-base64-encode-functions/#page","headline":"New cryptographic functions — encode_base64() and sha256() · Changelog","description":"Rulesets now support encode\\_base64() and sha256() functions for generating signed request headers directly in expressions.","url":"https://developers.cloudflare.com/changelog/post/2026-01-22-sha256-base64-encode-functions/","inLanguage":"en","image":"https://developers.cloudflare.com/changelog-preview.png","dateModified":"2026-01-22","datePublished":"2026-01-22","publisher":{"@type":"Organization","name":"Cloudflare","url":"https://www.cloudflare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
